cxbii
2015-07-31 17:55 deepin
对crontab不熟,查下man文档看看能否解决呗
Reply Like 0 View the author
https://bbs.deepin.org/post/31701
已经提示你语法错误了,你看一下默认的crontab是怎么写的,照葫芦画瓢
https://bbs.deepin.org/post/31701
改了不报错了,但是不能执行脚本
9 23 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts -- ...
https://bbs.deepin.org/post/31701
这个能执行才是怪事
https://bbs.deepin.org/post/31701
怎么才能执行啊,没办法了
46 22 * * * cd/mnt && ./resw.sh
日志都提示执行了,但是就没看到结果
https://bbs.deepin.org/post/31701
不是少了个 * 么
https://bbs.deepin.org/post/31701
cd /mnt .
https://bbs.deepin.org/post/31701
不是少了个 * 么
Popular Events
More
脚本文件·························
脚本文件1··················
#! /bin/sh
while read ip
do
ping -c 2 $ip > /dev/null && echo $ip >>upip.txt || echo "`date +%F" "%T`" $ip >>downip.txt
done < allip.txt
awk 'NR==FNR{a[$1]=$0;next}NR>FNR{if($1 in a)print a[$1]}' host.txt upip.txt >>1.txt
while read ip
do
./1.exp $ip
done < 1.txt
脚本文件2··············
#! /usr/bin/expect -f
set timeout 5
set ip [lindex $argv 0]
set username [lindex $argv 1]
set password [lindex $argv 2]
spawn telnet $ip
expect "Username:"
send "$username\r"
expect "assword:"
send "$password\r"
expect "*>"
send "system\r"
expect "*]"
#send "reboot system\r"
#interact
expect eof
crontab任务
*/10 * * * root sh /mnt/resw.sh
cron日志文件
Jul 30 22:48:55 deepin-pc anacron[983]: Anacron 2.3 started on 2015-07-30
Jul 30 22:48:55 deepin-pc cron[931]: (CRON) INFO (pidfile fd = 3)
Jul 30 22:48:56 deepin-pc cron[1045]: (CRON) STARTUP (fork ok)
Jul 30 22:48:56 deepin-pc cron[1045]: Error: bad day-of-week; while reading /etc/crontab
Jul 30 22:48:56 deepin-pc cron[1045]: (*system*) ERROR (Syntax error, this crontab file will be ignored)
Jul 30 22:48:56 deepin-pc anacron[983]: Will run job `cron.daily' in 5 min.
Jul 30 22:48:56 deepin-pc anacron[983]: Jobs will be executed sequentially
Jul 30 22:48:56 deepin-pc cron[1045]: (CRON) INFO (Running @reboot jobs)
Jul 30 22:53:55 deepin-pc anacron[983]: Job `cron.daily' started
Jul 30 22:53:55 deepin-pc anacron[1433]: Updated timestamp for job `cron.daily' to 2015-07-30
Jul 30 22:54:04 deepin-pc anacron[983]: Job `cron.daily' terminated
Jul 30 22:54:04 deepin-pc anacron[983]: Normal exit (1 job run)
大神帮忙解决下················
直接执行脚本可以,任务计划不能执行,报错