简单的定时任务
sudo apt-get update #更新包
sudo apt-get install cron #安装crontab
vi mytest.cron #创建一个简单的定时任务文档(.cron)
*/2 * * * * echo "hello ,world. this is my first crontab program!" >> /home/ubuntu/log.txt
crontab mytest.cron #添加定时任务
sudo service cron start #启动定时任务
service cron status #查看定时任务状态
等待三分钟 ls查看当前目录文件
cat log.txt #查看定时任务执行效果
在等待三分钟 ls
cat log.txt