LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Simple bash script (http://www.linuxquestions.org/questions/programming-9/simple-bash-script-330428/)

Soulful93 06-04-2005 07:16 PM

Simple bash script
 
I've written a simple bash script, and scheduled it to run as root with cron.

I'm directing all output to three different files on my desktop and when I manually run the script it works fine, when cron executes the script I get two empty output files on my desktop.

Cron is executing the script with root permissions so I can't figure out whats going on.

Code:

#!/bin/bash
cd /root/Documents/Installed/Rootkit/rkhunter/files
rkhunter --update > /home/soulful93/Desktop/Security_Rkhunter.txt
rkhunter -c --skip-keypress >> /home/soulful93/Desktop/Security_Rkhunter.txt
cd /root/Documents/Installed/Rootkit/chkrootkit*
./chkrootkit > /home/soulful93/Desktop/Security_Chkrootkit.txt
cd
freshclam > /home/soulful93/Desktop/Security_Freshclam.txt

By the way the Security_Chkrootkit.txt file always contains output. The Security_Rkhunter, and Freshclam are the two I'm having problems with. So, any ideas? :scratch:

ilikejam 06-04-2005 07:26 PM

Hi.

Try replacing the > redirect with &>
That will pipe std. error to the files as well as std out.

Dave


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