bash script code help to make zip/tar of several folders
You could create a bash file for it, if you intend to run it in a cronjob for example and add some other commands like a mysqldump beforehand
You need to create a file like backup.sh with the following contents(You may need to alter the path to bash, you can find bash with whereis bash
)
#!/bin/bash# # Backup script# # Format: YEAR MONTH DAY - HOUR MINUTE SECONDDATE=$(date +%Y%m%d-%H%M%S)# MySQL backup fileMYSQLTARGET="/var/file/backup-mysql-$DATE.sql"# Target fileTARTARGET="/var/file/backup-$DATE.tar.gz"# MySQL dump# you cannot have a space between the option and the password. If you omit the password value # following the --password or -p option on the command line, you are prompted for one.mysqldump -u root -ppassword --all-databases > $MYSQLTARGETtar -czvf $TARTARGET $MYSQLTARGET /home/code/bots /var/config /var/system
PS. This is untested code. It's just an example of how a bash script works in the current replied context.