Fell free to modify as you need. It works in ubuntu and debian distros. --------------------------- #!/bin/bash DATE=$(date +"%Y-%m-%d_%H-%M-%S") NAME=$(hostname) PASS=$(cat /etc/mysql/debian.cnf | grep "password" | head -n1 | tr -d ' ' | cut -d "=" -f2) mkdir ispconfig_"$NAME"_"$DATE" cd ispconfig_"$NAME"_"$DATE" tar zcvf etc.tar.gz /etc tar zcvf ispconfig_software.tar.gz /usr/local/ispconfig mysqldump -uroot -p$PASS dbispconfig > ispconfig_db_backup.sql ---------------------------
Yes you are rigth. Do you know witch database table is stored the path of backup? (/var/backup as default, but the user can change it) I can do a query to have this path and cd to the bakup folder after create the new ispconfig_"$NAME"_"$DATE"
Here an update: -------------------- #!/bin/bash DATE=$(date +"%Y-%m-%d_%H-%M-%S") NAME=$(hostname) PASS=$(cat /etc/mysql/debian.cnf | grep "password" | head -n1 | tr -d ' ' | cut -d "=" -f2) BDir=$(mysql -u root -p"$PASS" -D dbispconfig -e "SELECT config FROM server WHERE server.server_id=1" | sed 's|\\n|\n|g' | grep "backup_dir=" | sed 's|backup_dir=||') cd $BDir mkdir ispconfig_"$NAME"_"$DATE" cd ispconfig_"$NAME"_"$DATE" tar zcvf etc.tar.gz /etc tar zcvf ispconfig_software.tar.gz /usr/local/ispconfig mysqldump -uroot -p$PASS dbispconfig > ispconfig_db_backup.sql cd ~ -------------------- save as ispSWbackup.sh install it in /usr/local/bin with: $ sudo install ispSWbackup.sh /usr/local/bin Edit: removed temporal file