-   Linux - Newbie (
-   -   problem with cron jobs (

umk 01-25-2005 03:38 AM

problem with cron jobs

I've tried to automate the update of security patches by doing the following as root:
1. I've written the file /usr/bin/security containing:
#! /bin/sh
apt-get update
init 6
2. I've chmod 755 /usr/bin/security
3. I've added the following new job to crontab:
5 8 * * * /usr/bin/security
4. I've checked that by entering /usr/bin/security as root the security patches get updated. This worked fine.
5. At 8am I rebooted, and waited full of expectation...
6. At 8.05am I received an email saying that:
"/usr/bin/security: init: command not found"

How come the command cannot be found by cron, even though it works if entered manually?

Thanks, umk

Donboy 01-25-2005 07:39 AM

How about putting the full path to init...

/sbin/init 6

instead of just "init 6". I think the problem is, you're running the commands manually as the root user and init is found in your path just fine, whereas when run from cron, its not getting the full path to init.

umk 01-25-2005 10:14 AM

Thanks, Donboy,

that solved the problem. umk

All times are GMT -5. The time now is 12:41 PM.