linux中利用crontab设置定时任务
linux中利用crontab设置定时任务:
# 每隔1个小时运行一次命令,四个*分别代表分,时,日,月,周
# crontab -l查看;crontab -e编辑
*/1 * * * * /root/bigdata/jars/data_migration_from_sqlserver/run.sh start >/dev/null 2>&1 &
*/1 * * * * /root/bigdata/jars/get_real_time_data_cc1/run.sh start >/dev/null 2>&1 &
*/10 * * * * /root/bigdata/jars/data_clean_cc1/run.sh start >/dev/null 2>&1 &
查看crontab日志:
tail -f /var/log/cron
注意:如果crontab命令没有加>/dev/null 2>&1 &,会将运行结果输出至/var/spool/mail/root
tail -f /var/spool/mail/root
God will send the rain when you are ready.You need to prepare your field to receive it.