Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-25-2005, 03:38 AM   #1
Registered: Jan 2005
Distribution: debian (woody)
Posts: 36

Rep: Reputation: 15
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
Old 01-25-2005, 07:39 AM   #2
Registered: Aug 2003
Location: Little Rock, Arkansas
Distribution: RH, Fedora, Suse, AIX
Posts: 736

Rep: Reputation: 31
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.
Old 01-25-2005, 10:14 AM   #3
Registered: Jan 2005
Distribution: debian (woody)
Posts: 36

Original Poster
Rep: Reputation: 15
Thanks, Donboy,

that solved the problem. umk


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cron Jobs XaViaR Linux - General 1 06-23-2005 06:57 PM
SUID problem running cron jobs? mitchloft Fedora 4 03-24-2005 12:30 PM
cron jobs working2hard Linux - Software 0 07-28-2004 05:31 PM
CRON Jobs scottpioso Linux - Software 63 11-28-2003 06:45 PM
cron jobs Zyanid Linux - Software 0 08-27-2002 05:10 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:44 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration