Results 1 to 6 of 6
Hi Im new to linux, using ubuntu 10.04.
I have been playing around with crontab and have no problems scheduling a job which runs a script file containing the following ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 11-01-2010 #1Just Joined!
- Join Date
- Oct 2010
- Posts
- 38
running scripts from crontab
Hi Im new to linux, using ubuntu 10.04.
I have been playing around with crontab and have no problems scheduling a job which runs a script file containing the following command:
mkdir Desktop/testdir.
However, when I try to do the following in the script file nothing happens..
top -b -n 1 > /tpm/topoutput.txt
Similarly the following doesnt do anything either:
ifconfig > Desktop/ifconfigoutput.txt
Is there something im missing?
Any help would be appriciated
- 11-01-2010 #2
Yes, you're missing the same thing I did! Cron is usually run by a special cron user who does not have the same command path as root (there is probably be a security reason for this). Consequently scripts that are to be run by cron need full path names for all commands.
"I'm just a little old lady; don't try to dazzle me with jargon!"
- 11-02-2010 #3Just Joined!
- Join Date
- Oct 2010
- Posts
- 38
cheers, but what exactly do you mean by full paths?...
from the examples in my previous post the script file that runs a mkdir command works fine, its just the top and ifconfig commands that dont..
if you could elaborate that would be brilliant, im really new to this
- 11-03-2010 #4Linux Guru
- Join Date
- Oct 2007
- Location
- Tucson AZ
- Posts
- 2,563
Instead of using:
use: /sbin/ifconfig Desktop/ifconfigoutput.txtifconfig > Desktop/ifconfigoutput.txt
Similar for top: /usr/bin/top -b -n 1 > /tpm/topoutput.txt
You can find where ifconfig and top are on your system with whereis or locate commands if the above doesn't work.
- 11-04-2010 #5Just Joined!
- Join Date
- Oct 2010
- Posts
- 38
Thanks much appriciated
- 11-04-2010 #6
The absolute path for Desktop is /home/user/Desktop, where user is the username of the user who owns the desktop. Desktop is a valid path only from /home/user, nowhere else.


Reply With Quote
