Running Programs from CRON as root

Philip Hallstrom freebsd at philip.pjkh.com
Wed Jun 29 20:39:06 GMT 2005


On Wed, 29 Jun 2005, Gerard Seibert wrote:

> I am not sure how to go about this. If I do not want to touch the system
> CRON, is it possible to create a personal CRON that could  run two
> programs, both at the super user level"
>
> Example:
>
> I want to update the ports tree and then run portmanager to install the
> updates. These obviously have to be run as root. Is there a way I can
> force this to happen without actually leaving the system logged in as
> root?

Sure... as root, type "crontab -e" and put in your entries according to 
the crontab format.  This will store the entries in root's personal cron 
file.  Not /etc/crontab...

Save the file.

Logout.

I find it helpful to paste this at the top of my crontab files to help me 
remember the format...


##################################################
#
# field         allowed values
# -----         --------------
# minute        0-59
# hour          0-23
# day of month  1-31
# month         1-12 (or names, see below)
# day of week   0-7 (0 or 7 is Sun, or use names)
# command		/path/to/cmd arg1 arg2
#
##################################################


More information about the freebsd-questions mailing list