1.添加定时任务并保存 hadoop@hadoopSlave2:/opt/shell$ crontab -e 添加:47 12 * * * /opt/shell/showDate.sh >> /opt/shell/hello.log 2.重启cron进程 hadoop@hadoopSlave2:/opt/shell$ service cron restart/stop/start stop: Rejected send message, 1 matched rules; type="method_call", sender=":1.83" (uid=1000 pid=32646 comm="stop cron ") interface="com.ubuntu.Upstart0_6.Job" member="Stop" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init") start: Rejected send message, 1 matched rules; type="method_call", sender=":1.84" (uid=1000 pid=32643 comm="start cron ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init") 3.查看crontab服务是否启动 hadoop@hadoopSlave2:/opt/shell$ service cron status cron start/running, process 989 4.查看已经存在的定时任务 hadoop@hadoopSlave2:/opt/shell$ crontab -l 47 12 * * * /opt/shell/showDate.sh >> /opt/shell/hello.log 5.hadoop@hadoopSlave2:/opt/shell$ vim showDate.sh #!/bin/bash date +%A 6.删除 hadoop@hadoopSlave2:/opt/shell$ crontab -r hadoop@hadoopSlave2:/opt/shell$ crontab -l no crontab for hadoop
ubuntu crontab创建定时任务
猜你喜欢
转载自houshangxiao.iteye.com/blog/2076197
今日推荐
周排行