Forum Discussion
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?
- Suresh_Jo_32729Nimbostratus
vi backup.sh
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
- Suresh_Jo_32729Nimbostratus
Can someone check and let me know if any changes are required in the above script .
- Stanislas_Piro2Cumulonimbus
did you see this code?
- Stanislas_Piro2Cumulonimbus
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
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com