freebsd-update via cron

jghelfman40 used Ask the Experts™
I was wondering how I would be able to do a freebsd-update via root's crontab (not /etc/crontab) with the following switches:

-s,-k and -t

for example:

@daily freebsd-update -s myserver -k longhashkey -t cron

I can run this on the command line with sudo, and it works, however I can't seem to get this to work via root's cron. The only item I have not tried is using the full path of freebsd-update in the cron.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2013
Top Expert 2013
If freebsd-update is not in /usr/bin you will need the full path!
Besides that, please note that there is no full environment under cron (user profiles are not executed).
So if freebsd-update (which I don't know) needs some variables to be set or some particular PATH settings, better use a script to accomplish what you desire. Inside this script you can either "source" root's profile or set the desired values explicitly.


When I wrote the question, and I realized the only thing I didn't try was the full path, my first thought was to put the full path in and see if that worked. You answered the question in the meanwhile, and that proved the solution worked.


Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial