cron question

Giorgos Keramidas keramida at ceid.upatras.gr
Wed Apr 5 09:06:55 UTC 2006


On 2006-04-05 07:03, Marlon Martin <mmp013 at gmail.com> wrote:
> i created a simple shell script:
>
> filename: rn
>
> #!/bin/sh
> rndc dumpdb
>
> what it does, is just dump the hostname and IP addresses in /var/dump
> i set the time in 2 minutes but when i checked the logs, it doesnt work any
> idea what did i missed here?
>
> ==============================================
>
> SHELL=/bin/sh
> PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
> HOME=/var/log
> #
> #minute	hour	mday	month	wday	who	command
> #
> */5	*	*	*	*	root	/usr/libexec/atrun
> #
> # Save some entropy so that /dev/random can re-seed on boot.
> */11	*	*	*	*	operator /usr/libexec/save-entropy
> #
> # Rotate log files every hour, if necessary.
> 0	*	*	*	*	root	newsyslog
> #
> # Perform daily/weekly/monthly maintenance.
> 1	3	*	*	*	root	periodic daily
> 15	4	*	*	6	root	periodic weekly
> 30	5	1	*	*	root	periodic monthly
> /2     *       *       *       *         root   /home/ken/rn

You are missing a star '*' character before '/2' near the beginning of
the line immediatelly above.  Try this instead:

  */2   *       *       *       *         root   /home/ken/rn

Then make sure /home/ken/rn is executable.

I'd also suggest moving your `rn' script in `/root/scripts/rn' and
making `root:wheel' its owner.  The crontab entries from `/etc/crontab'
are executed with root permissions, so giving the user `ken' control
over what runs is creating a backdoor for anyone who gets access to that
non-root user account.

- Giorgos



More information about the freebsd-questions mailing list