Auto back script in cron shell

All,

I have deployed one script in ltm running in 12.1.2 for auto backup in cron shell. I am not getting the desired result. Can someone pls check and let me know what corrections are required in the script.

Script:

vi backup.sh

!/bin/bash

daily_backup.sh HOST=$HOSTNAME DATE=date +%m%d LDIR=“/var/local/ucs/” DDIR=“/var/local/ucs/daily/” tmsh save sys ucs $LDIR$HOST.ucs mv $LDIR$HOST.ucs $DDIR$HOST.$DATE.ucs /usr/bin/find /var/local/ucs/daily/ -mtime +45 -exec rm {} \; USER=xxxx PASS=xxxx cd $DDIR ftp -nv xxxx.com exit 1

and then add the crontab -e command and add in this line 20 23 * * * bash /var/scripts/daily_backup.sh

Also how I can check if the config file is generating in ltm locally?

vi backup.sh

!/bin/bash

daily_backup.sh HOST=$HOSTNAME DATE=date +%m%d LDIR=“/var/local/ucs/” DDIR=“/var/local/ucs/daily/” tmsh save sys ucs $LDIR$HOST.ucs mv $LDIR$HOST.ucs $DDIR$HOST.$DATE.ucs /usr/bin/find /var/local/ucs/daily/ -mtime +45 -exec rm {} \; USER=xxxxx PASS=xxxx, cd $DDIR ftp -nv xxxx.com<< SCRIPT quote USER $USER quote PASS $PASS bin cd $HOST put $HOST.$DATE.ucs quit SCRIPT exit 1

and then add the crontab -e command and add in this line 20 23 * * * bash /var/scripts/daily_backup.sh

Can someone check and let me know if any changes are required in the above script .

did you see this code?

don’t use crontab but icall

tmsh create sys icall script backup
tmsh modify sys icall script backup definition { exec /var/scripts/daily_backup.sh }
tmsh create sys icall handler periodic backup-handler first-occurrence 2017-07-21:00:00:00 interval 604800 script backup
tmsh save sys config