LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


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

Rep: Reputation: 15
problem with cron jobs


Hi,

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
Donboy
Member
 
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
umk
Member
 
Registered: Jan 2005
Distribution: debian (woody)
Posts: 36

Original Poster
Rep: Reputation: 15
Thanks, Donboy,

that solved the problem. umk
 
  


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:20 AM.

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