LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 08-27-2012, 03:16 AM   #1
figure20012
Member
 
Registered: Apr 2012
Posts: 75

Rep: Reputation: Disabled
send all output to file, gzip in crontab


13 11 * * * /home/devin/Desktop/bla.sh &> /home/devin/Desktop/bla.log | exec /bin/gzip ;
can someone tell me why it dows not work
please help
 
Old 08-27-2012, 03:23 AM   #2
evo2
Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,590

Rep: Reputation: 1228Reputation: 1228Reputation: 1228Reputation: 1228Reputation: 1228Reputation: 1228Reputation: 1228Reputation: 1228Reputation: 1228
Hi,

that looks like it wouldn't even work on the command line. How about the following:
Code:
/home/devin/Desktop/bla.sh 2>&1 | /bin/gzip - > /home/devin/Desktop/bla.log.gz
Evo2.
 
1 members found this post helpful.
Old 08-27-2012, 03:29 AM   #3
evo2
Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,590

Rep: Reputation: 1228Reputation: 1228Reputation: 1228Reputation: 1228Reputation: 1228Reputation: 1228Reputation: 1228Reputation: 1228Reputation: 1228
Oops, you actually explicitly asked why it wouldn't work. Hmm..

Firstly you have "&>" which will background the process and send the stdout to the file /home/devin/Desktop/bla.log (Perhaps you wanted ">&" or "2>&1" which will send stderr to stdout). Next you have a pipe, "|" to "exec /bin/gzip"... there a number of issues here. Why the "exec"? And gzip will only take stdin as input if given "-" as the input file etc, and you've already redirected the output of your script to bla.log.

HTH,

Evo2.
 
1 members found this post helpful.
Old 08-27-2012, 03:59 AM   #4
figure20012
Member
 
Registered: Apr 2012
Posts: 75

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by evo2 View Post
Hi,

that looks like it wouldn't even work on the command line. How about the following:
Code:
/home/devin/Desktop/bla.sh 2>&1 | /bin/gzip - > /home/devin/Desktop/bla.log.gz
Evo2.
thanks a lot for helping evo2
 
Old 08-27-2012, 04:54 AM   #5
figure20012
Member
 
Registered: Apr 2012
Posts: 75

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by evo2 View Post
Hi,

that looks like it wouldn't even work on the command line. How about the following:
Code:
/home/devin/Desktop/bla.sh 2>&1 | /bin/gzip - > /home/devin/Desktop/bla.log.gz
Evo2.
can i mail the gzip file to my account?
 
Old 08-27-2012, 05:26 AM   #6
pan64
Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 5,146

Rep: Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364
yes, you can but it depends on the size of that file. See the man page of mailx: http://linux.die.net/man/1/mailx, you can try something like this:
echo "this is the log file of ... at ...." | mailx -s <subject> -a <attachment> <your address>
 
1 members found this post helpful.
  


Reply

Tags
crontab, gzip


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
E-Mailing whole output of a file with crontab amario26 Linux - Newbie 1 05-03-2011 12:44 PM
[SOLVED] how to send the output of send command to a file auma78 Linux - Newbie 2 01-23-2011 01:06 AM
How to send a html file from crontab? GRD Linux - General 3 06-04-2008 04:18 AM
How to send a html file as an file attachment to my mail from crontab? GRD Linux - Newbie 2 06-03-2008 12:39 PM


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

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration