Monday, January 12, 2015

how to redirect stdout & stderr to logger?

logger come in handy 

* * * * *  cd /usr/local/bin; sh test_hi.sh 2>&1 | logger


# cat test_hi.sh 
#!/bin/bash


echo "Hi testing logger.. thanks"

Test

# tail -f  /var/log/messages
Jan 13 02:20:01 simba-c1 root: Hi testing logger.. thanks


If you don't need any log then you may simple use like 

* * * * * cd /usr/local/bin; sh sh test_hi.sh >/dev/null 2>&1


rsync with delete option and different ssh port

How to rsync e.g PIPELINE dir from Source to Destination? #rsync -avzr   --delete-before  -e "ssh -p $portNumber"  /local...