20180718_jeffrey - silenceuncrio/diary GitHub Wiki
1300
review
1325
M300 再加上 cronie
這 recipe 之後除了擁有 crond
和 crontab
之外
root@Cellular Router:~# type crond
crond is /usr/sbin/crond
root@Cellular Router:~# type crontab
crontab is /usr/bin/crontab
還有 /etc/init.d/crond
這支 script
#!/bin/sh
### BEGIN INIT INFO
# Provides: crond crontab
# Default-Start: 2345
# Default-Stop: 016
# Short-Description: run cron daemon
# Description: cron is a standard UNIX program that runs user-specified
# programs at periodic scheduled times. vixie cron adds a
# number of features to the basic UNIX cron, including better
# security and more powerful configuration options.
### END INIT INFO
CROND=/usr/sbin/crond
CONFIG=/etc/sysconfig/crond
[ -f $CONFIG ] || exit 1
[ -x $CROND ] || exit 1
. $CONFIG
# Source function library.
. /etc/init.d/functions
case "$1" in
start)
echo -n "Starting crond: "
start-stop-daemon --start --quiet --exec $CROND -- $CRONDARGS
RETVAL=$?
if [ $RETVAL -eq 0 ] ; then
echo "OK"
else
echo "FAIL"
fi
;;
stop)
echo -n "Stopping crond: "
start-stop-daemon --stop --quiet --pidfile /var/run/crond.pid
RETVAL=$?
if [ $RETVAL -eq 0 ] ; then
echo "OK"
else
echo "FAIL"
fi
;;
status)
status crond
exit $?
;;
restart)
$0 stop && sleep 1 && $0 start
;;
*)
echo "Usage: /etc/init.d/crond {start|stop|status|restart}"
exit 1
esac
exit 0
直接 start crond 看看
root@Cellular Router:~# /etc/init.d/crond start
Starting crond: /var/spool/cron: No such file or directory
/var/spool/cron: mkdir: No such file or directory
FAIL
1530
目前 /var/spool
被 link 到的地方還未存在
root@Cellular Router:/var/log# ls -al /var/
drwxr-xr-x 11 root root 1448 Jul 18 05:38 .
drwxr-xr-x 17 root root 1248 Jul 16 09:20 ..
lrwxrwxrwx 1 root root 20 Jul 18 05:38 spool -> /tmp/icos/smtp/spool
先使用 mkdir -p /tmp/icos/smtp/spool
把該地方建立出來
/etc/init.d/crond start
便可執行
科普一下 crontab 熟悉一下使用方式