Im writing a simple bash script where the bash script will sync my live servers with my staging servers. I am using rsync to do this.
What I need is a log file for each day the script was executed. I am using the following command
rsync -azP --stats source-directory [email protected]:destination-directory --log-file=~/public_html/rsynclogs/rsync-backup-log-`date +"%Y-%m-%d"`.log
The error this command gives me is
rsync: failed to open log-file ~/public_html/rsynclogs/rsync-backup-log-2017-01-11.log: No such file or directory (2)
Ignoring "log file" setting.
So most probably it is looking for an existing log file but I want it to be created if it does not exist. Please advice on how I can achieve this.
--log-file=$HOME/path
OR--log-file="$HOME/path"
OR--log-file ~/path
– Dissipated