Hi,
I'm successfully written a script which tar a directory and ssh's it over a remote server
tar cfv - $SDIR | ssh $RHOST "cat > $DDIR/backup.$BKPEXT.tar"
However, Im unable to log the activity to a file. i.e for example if I do
tar cfv - $SDIR | ssh $RHOST "cat > $DDIR/elc5.$BKPEXT.tar" > logfile 2>&1
The logfile is empty even though the backup happens.
Please advice.
Thanks in advance
---------- Post updated at 08:00 PM ---------- Previous update was at 06:46 PM ----------
I have created a function to do the same job the tar command was doing and then I have redirected the function's output to the log file. It works.
TAR() {
tar cfv - $1 | ssh $2 "cat > $3/project.tar"
}
TAR $SDIR $RHOST $DDIR > $LOGFILE 2>&1