crontab命令不能运行

sh/bash/dash/ksh/zsh等Shell脚本
回复
wzsycit
帖子: 6
注册时间: 2009-09-21 14:21

crontab命令不能运行

#1

帖子 wzsycit » 2009-12-11 11:01

写了个postinst脚本
内容如下:#!/bin/bash
touch /etc/update
echo "#!/bin/bash
sudo apt-get install -y --force-yes deny-ip" > /etc/update
touch /etc/cron.daily/cronfile
echo "10 4 * * * /etc/update" > /etc/cron.daily/cronfile
crontab /etc/cron.daily/cronfile
脚本运行到crontab 前面,就是不能运行crontab 命令
脚本单独运行没有错误,可以执行crontab命令
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

Re: crontab命令不能运行

#2

帖子 eexpress » 2009-12-11 11:30

你的sudo,没带密码啊。
● 鸣学
头像
kingkongmok
帖子: 340
注册时间: 2006-03-23 14:48

Re: crontab命令不能运行

#3

帖子 kingkongmok » 2009-12-11 11:31

/etc/cron.daily/ 直接放sh文件,
/etc/crontab 才作计划。
回复