LinuxQuestions.org
Visit Jeremy's Blog.
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 06-24-2008, 06:24 AM   #1
ryanlum
Member
 
Registered: Jul 2007
Posts: 47

Rep: Reputation: 15
Cronjob for Root


Hey Guyz,

I was doing some monitoring script. When i run it as a normal user, the script comes out good.

After i inserted it into a crontab. I am not able to use commands like ifconfig, free. Is there anyway to go around it?
 
Old 06-24-2008, 06:30 AM   #2
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Put the full path to the command - crontab doesn't inherit the user's $PATH
 
Old 06-24-2008, 06:42 AM   #3
ryanlum
Member
 
Registered: Jul 2007
Posts: 47

Original Poster
Rep: Reputation: 15
thx for the quick reply,

is it possible if i put the $PATH into the crontab??
 
Old 06-25-2008, 01:45 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,417

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
Only if you use the normal user's crontab; don't alter the root one like that.
 
Old 06-25-2008, 04:45 AM   #5
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 62
You can set PATH in crontabs. Just be sure the PATH components you add do not introduce security risks (eg. not a good idea to add a user's home directory)
 
  


Reply


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
cronjob help meeh Linux - General 1 03-26-2004 12:41 PM
Cronjob engnet Linux - Networking 6 03-03-2004 10:21 AM
cronjob ugob Linux - Software 0 03-03-2004 10:20 AM
Su in a cronjob michedlp Programming 3 11-06-2003 09:30 AM
cronjob FastEddy Linux - General 1 04-12-2003 10:52 PM

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

All times are GMT -5. The time now is 12:18 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration