A cron job I have created to run a backup script every week day at 5:10PM
# m h dom mon dow command # backup simple invoices and subversion repo # every week day 10 17 * * 1-5 /usr/local/bin/backup.sh
Here are some different command output redirection options
Redirect standard out to null but still display error messages
# redirect standard out to null 10 17 * * 1-5 /usr/local/bin/backup.sh > /dev/null
Swallow error messages but display the standard output (this can mean alot of output if you use tar -v (verbose))
# redirect standard error to null 10 17 * * 1-5 /usr/local/bin/backup.sh 2> /dev/null
Very quite script. Standard Out and Error directed to the bitbucket (/dev/null)
# redirect standard error and standard out to null 10 17 * * 1-5 /usr/local/bin/backup.sh > /dev/null 2>&1
STDOUT the text displayed in the console when the program /script you are running is going OK
e.g.
root@computer:~# tar -czvf vmware-tools-distrib.tar.gz vmware-tools-distrib/
vmware-tools-distrib/
vmware-tools-distrib/vmware-install.pl
vmware-tools-distrib/INSTALL
vmware-tools-distrib/etc/
STDERR the text displayed in the console when there is something wrong
root@computer:~# tar -czvf vmware-tools-distrib.tar.gz /root/vmware-tools-distrib/
tar: Removing leading `/' from member names
STDIN the command and data you pass into the program / script your are running
root@computer:~# echo hello | xargs -IINPUT echo Your stdin is INPUT
Your stdin is hello
0 Comments