Tag - crontab

alpine linux crontab BusyBox    2017-04-01 17:21:10    1534

首先alpine内嵌的是BusyBox,使用alpine的crontab实际就是使用BusyBox的crond服务,那么下来就简单介绍下如何使用吧,网上教程还是比较多的:

配置文件存放位置:

配置文件是在如下目录中的

  1. /var/spool/cron/crontabs/root

使用方式

  1. 向crontab的配置文件中添加配置
  1. vi /var/spool/cron/crontabs/root
  2. # 或者
  3. crontab -e
  4. # 填入如下内容,最后一行为我添加的测试任务
  5. # do daily/weekly/monthly maintenance
  6. # min hour day month weekday command
  7. */15 * * * * run-parts /etc/periodic/15min
  8. 0 * * * * run-parts /etc/periodic/hourly
  9. 0 2 * * * run-parts /etc/periodic/daily
  10. 0 3 * * 6 run-parts /etc/periodic/weekly
  11. 0 5 1 * * run-parts /etc/periodic/monthly
  12. * * * * * echo "test" >> /app/test.log
  1. 启动crond
  1. crond
  1. 查看状态
  1. ps
  2. PID USER TIME COMMAND
  3. ·····
  4. 82 root 0:00 crond
  5. 292 root 0:00 ps
  1. 查看/app/test.log是否有输入内容
  1. cat test.log
  2. test
  3. test
  4. test
  5. test
  6. test

OK,至此对于c