解压tar xjvf vixie-cron-4.1.tar.bz2
修改Makefile
CC = arm-arago-linux-gnueabi-gcc -Wall -Wno-unused -Wno-comment
make
在当前文件夹下生成cron、crontab两个文件,拷贝到arm开发板
在/etc目录下创建cronConfig
mkdir cronConfig
cd cronConfig
新建文件: vi test.crontab
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/bin:/usr/sbin
HOME=/
* * * * * /etc/crontab/test.sh
新建文件: vi test.sh
#/bin/sh
d=$(date)
cd /etc/crontab
touch "$d"
执行 crontab test.crontab,执行crontab -l 可以看到加入的任务
执行cron 等待一分钟可以在当前文件夹下,查看生成以时间为名字的文件
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
* * * * * /etc/cronConfig/test.sh 一分钟一次
1 0 * * * /etc/cronConfig/test.sh 每天的00:01执行