مودل: bash script برای تهیه پشتیبان کامل از نرم افزار آموزش مجازی مودل

#!/bin/bash
now=$(date +"%m_%d_%Y")
pass="mysql-root-password"
echo "Backup will save in backup$now.tgz" && \
rm -f backup$now.tgz && \
echo "Start backup mysql ..." && \
mysqldump -u root -p$pass rastasoft_lms > ~/lms.rastasoft.sql && \
tar -zcf ~/lms.rastasoft.sql.tgz ~/lms.rastasoft.sql && \
echo "Mysql backup finished." && \
echo "Start backup data dir" && \
tar -zcf ~/lms.rastasoft.com.data.tgz /var/www/lms.rastasoft.com.data && \
echo "Data dir backup finished." && \
echo "Start backup application ..." && \
tar -zcf ~/lms.rastasoft.com.tgz /var/www/html/lms.rastasoft.com && \
echo "Application dir backup completed." && \
tar -zcf backup$now.tgz  ~/lms.rastasoft.sql.tgz ~/lms.rastasoft.com.data.tgz ~/lms.rastasoft.com.tgz && \
rm -f  ~/lms.rastasoft.sql ~/lms.rastasoft.sql.tgz ~/lms.rastasoft.com.data.tgz ~/lms.rastasoft.com.tgz && \
echo "Backup is ready in backup$now.tgz"

افزودن نظر جدید