LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 12-22-2009, 10:58 AM   #1
Ichabod7
LQ Newbie
 
Registered: Dec 2009
Posts: 2

Rep: Reputation: 0
Question output to /dev/null in shell script for multiple processes


I am modifying a cron script that was created by another user. The script tars and gzips a directory and then encrypts the file. The prior user had separate lines, one for creating the tarball and one for encrypting the file.

For ease of maintenance and clarity, I have combined these into one line of code:

tar pcz /directory/ | openssl des3 -salt -k password > /backupdir/file.tar.gz.des3 >> /dev/null 2>&1

This works fine, but sends output from the tar process to the screen. In this case, one line "tar: Removing leading `/' from member names"

Anyone know how I can also send the tar output to /dev/null?
 
Old 12-22-2009, 11:26 AM   #2
GooseYArd
Member
 
Registered: Jul 2009
Location: Reston, VA
Distribution: Slackware, Ubuntu, RHEL
Posts: 183

Rep: Reputation: 46
Quote:
Originally Posted by Ichabod7 View Post
I am modifying a cron script that was created by another user. The script tars and gzips a directory and then encrypts the file. The prior user had separate lines, one for creating the tarball and one for encrypting the file.

For ease of maintenance and clarity, I have combined these into one line of code:

tar pcz /directory/ | openssl des3 -salt -k password > /backupdir/file.tar.gz.des3 >> /dev/null 2>&1

This works fine, but sends output from the tar process to the screen. In this case, one line "tar: Removing leading `/' from member names"

Anyone know how I can also send the tar output to /dev/null?
try:

tar pcz /directory/ 2>/dev/null | openssl des3 -salt -k password > /backupdir/file.tar.gz.des3 >> /dev/null 2>&1

.andy
 
Old 12-22-2009, 11:38 AM   #3
Ichabod7
LQ Newbie
 
Registered: Dec 2009
Posts: 2

Original Poster
Rep: Reputation: 0
Works perfectly. Thanks.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
if output to /dev/null how can i still get some output ?? naveen76 Linux - Software 2 11-23-2009 10:12 AM
Output error / message to /dev/null ust Linux - Newbie 5 05-13-2009 08:22 PM
can you do threading or multiple processes in a shell script? BrianK Programming 8 08-07-2006 04:40 PM
shell script to read ps -e output and determine process double processes. dr_zayus69 Programming 1 09-21-2005 05:37 PM
All output to /dev/null? Satriani Programming 13 10-17-2003 01:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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