LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   howto catch output of bashinstruction (https://www.linuxquestions.org/questions/linux-general-1/howto-catch-output-of-bashinstruction-562017/)

Byenary 06-15-2007 07:54 AM

howto catch output of bashinstruction
 
Hello,

I have made a small script for a backup routine, if i run in manualy it goes fine but when i put in a cron, there is a part that goes wrong.
I am 7 zipping a directory but thats failing, since 7 zip does not has his own log file i can't check the problem.
When i run the 7z instruction manualy it goes fine and 7z displays what he is doing in the shell, so what i want to do is catch the output 7z generating while called by cron.

Thx

pixellany 06-15-2007 08:48 AM

Redirection is your friend....

capture the normal output of the command into a file:
command [arguments and stuff] > logfile

capture the errors into a file:
command [arguments and stuff] 2> logfile


To do both:
command [arguments and stuff] &> logfile


All times are GMT -5. The time now is 10:24 PM.