Results 1 to 3 of 3
I am running a linux file server using Ubuntu Server 8.10. I am still new to linux, so I use the machine to practice writing bash scripts and such.
Anyway, ...
- 04-30-2009 #1Just Joined!
- Join Date
- Apr 2009
- Posts
- 1
Some commands not working with Cron
I am running a linux file server using Ubuntu Server 8.10. I am still new to linux, so I use the machine to practice writing bash scripts and such.
Anyway, I have written a script for my server that emails me daily reports about the server at 6:25 every morning using Cron. The script has been working fine.
However, I've noticed that some commands are not executed properly when Cron executes the script. If I execute the script myself, however, the commands work.
For example, recently I have allowed some friends of mine to putty into my server. I want my daily report to be able to track who has logged in since the last report. The script works if I execute it manually. However, when the script is run through cron, it always says that 0 people have logged in that day. Why is this?
The commands I use in the script are:
date
who
grep
cat
wc -l
- 04-30-2009 #2Linux Guru
- Join Date
- Oct 2007
- Location
- Tucson AZ
- Posts
- 1,939
You may need to use the full path for commands in the script for it to work in cron.
/bin/date
/bin/cat
or wherever they are on your system.
- 04-30-2009 #3Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
We can't say much without taking a look into the script.


Reply With Quote