LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-15-2007, 07:54 AM   #1
Byenary
Member
 
Registered: Oct 2003
Distribution: edgy dapper feisty
Posts: 36

Rep: Reputation: 15
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
 
Old 06-15-2007, 08:48 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
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
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
howto print output of mount command as a table? ygloo Programming 8 10-18-2006 01:32 PM
Howto get the output of a running process using ssh? agouz Linux - Software 3 12-26-2005 12:11 PM
try catch(...) Sinner6 Linux - Newbie 3 06-25-2004 09:22 AM
Well...I'll catch you all later... Whitehat General 30 03-11-2004 09:32 PM
Howto Output with S-video out with IBM thinkpad a22m with ATI Mobility greendusk Linux - Hardware 0 02-12-2004 11:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:01 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
Open Source Consulting | Domain Registration