Adding crond
Adding the Cron Scheduler Daemon into 8.X
Synopsis: This covers the Installation of Cron Daemon into the Elphel353 using the 8.X firmware
I. Introduction
Crond and crontab are part of busybox in the Axis embedded distro.
Activating these is easy, but you need to add a few extra ingredients
to complete the process.
- Much of this was adapted from http://foxlx.acmesystems.it/?id=58
II. Installation:
0. Set some environment vars:
<root@cam>: AXIS_TOP_DIR=/path/to/your/elphel-dev-kit-base <root@cam>: cd $AXIS_TOP_DIR
1. Go into the busybox area (which is where crond is integrated)
<root@cam>: cd packages/apps/busybox
2. configure crond and crontab in busybox:
<root@cam>: make menuconfig ==> Miscellaneous Utilities --> Select Crond --> Select Crontab --> exit, exit, save when asked
3. This config isn't the real one, you must copy it into busyboxconfig to make it stick:
<root@cam>: diff .config busyboxconfig <root@cam>: cp .config busyboxconfig
4a. Now add the init script in the SDK to create the right directory inside the FOX fimage end the script to start and stop the crond daemon.
Go in the packages/initscripts folder and create a folder named crond:
<root@cam>: cd $AXIS_TOP_DIR/packages/initscripts <root@cam>: mkdir crond <root@cam>: cd crond
4b. Now copy inside it these files: rc, conf, Makefile as follows:
- Please Note: we've added an extra line in Makefile to touch the config files which differs from the
example in http://foxlx.acmesystems.it/?id=58
First we'll make these files with cat:
<root@cam>: cat << ENDOFIT > rc #! /bin/sh . /etc/init.d/functions.sh . /etc/conf.d/crond case "$1" in start) begin "Starting crond" crond $CROND_OPTIONS end $? ;; stop) begin "Stopping crond" killall crond end $? ;; *) error "Usage: $0 start|stop" ;; esac ENDOFI
<root@cam>: cat << ENDOFIT > conf CROND_OPTIONS="" ENDOFIT
- Note: On this next one: Make sure that the following has TABS in the indented lines or "make" will fail!
I've tried to cut-and-paste these linesto check for consistency, but its not 100% accurate. Depends on your editor.
<root@cam>: cat << ENDOFIT > Makefile include \$(AXIS_TOP_DIR)/tools/build/Rules.axis OWN = -o root -g root install: \$(INSTALL) \$(OWN) -m 0755 rc "\$(prefix)"/etc/init.d/crond \$(INSTALL) \$(OWN) -m 0644 conf "\$(prefix)"/etc/conf.d/crond \$(LN) -sf ../init.d/crond "\$(prefix)"/etc/rc0.d/K90crond \$(LN) -sf ../init.d/crond "\$(prefix)"/etc/rc1.d/K90crond \$(LN) -sf ../init.d/crond "\$(prefix)"/etc/rc2.d/K90crond \$(LN) -sf ../init.d/crond "\$(prefix)"/etc/rc3.d/S90crond \$(LN) -sf ../init.d/crond "\$(prefix)"/etc/rc4.d/S90crond \$(LN) -sf ../init.d/crond "\$(prefix)"/etc/rc5.d/K15crond \$(LN) -sf ../init.d/crond "\$(prefix)"/etc/rc6.d/K15crond mkdir "\$(prefix)"/var/spool mkdir "\$(prefix)"/var/spool/cron mkdir "\$(prefix)"/mnt/flash/crontabs touch "\$(prefix)"/mnt/flash/crontabs/root \$(LN) -sf /mnt/flash/crontabs "\$(prefix)"/var/spool/cron/crontabs ENDOFIT
5. Go back to the SDK root folder and edit the main Makefile.
<root@cam>: cd $AXIS_TOP_DIR <root@cam>: vi Makefile -> Search for SUBDIRS list: -> Add "packages/initscripts/crond" to end of list -> You will have to add a continuation backslash to the prior line
6. Make the image as usual:
<root@cam>: make (or use Kdevelop)
7. FBI WARNING: since there is no Mail services on elphel, all stderr and stdout must be handled in your crontab.
Otherwise crond can fail, certainly your scripts will fail.
<root@cam>: cat << ENDOFIT > ~/root.cron # Sample crontab file */2 * * * * /bin/echo "cron is good" >> /mnt/flash/root/cron_check.out 2>&1 ENDOFIT
8. Now test:
<root@cam>: crontab root.cron <root@cam>: crontab -l