当前位置: 技术问答>linux和unix
crontab 设置问题!
来源: 互联网 发布时间:2015-12-21
本文导语: 关于crontab,想设置在每月最后一天运行,如何实现?多谢! | 1 1 31 1,3,5,7,8,10,12 * /pro > /dev/null 2>&1 | [code]if [ "$(date -d 'tomorrow' +%d)" = 1 ]; then echo "it is time to do...." ...
关于crontab,想设置在每月最后一天运行,如何实现?多谢!
|
1 1 31 1,3,5,7,8,10,12 * /pro > /dev/null 2>&1
|
[code]if [ "$(date -d 'tomorrow' +%d)" = 1 ]; then
echo "it is time to do...."
fi[/code]
SCO:
[code]ym=`date +%m" "%Y`
if [ `date +%d` = `cal $ym|xargs|awk '{print $NF}'` ]
then
sh yourshell
fi
[/code]
echo "it is time to do...."
fi[/code]
SCO:
[code]ym=`date +%m" "%Y`
if [ `date +%d` = `cal $ym|xargs|awk '{print $NF}'` ]
then
sh yourshell
fi
[/code]