Fully configurable - Patlol/Handy-Web-Server-Backup--HwsB-- GitHub Wiki

You disposed of a configuration file (hwsb.conf) where there is more than replace the example values ​​with your values​​. Your configuration file(s) must be in the same directory as the script files.

You can have multiple configuration files for multiple uses on your server. hwsb use the default hwsb.conf file. If you want to use another file pass it as an argument.
By example for a site ./hwsb.sh site1.conf, then to another site with different periods ./hwsb.sh site2.conf

You can, of course, save several files directories in the same backup process by entering their paths separated by a space.
If you used the same parameters also, you can enter the path of several sites for the same backup process.

Do not type "/" at the end of path: /var/log ok, /var/log/ NO!

Details of the configuration file

  • Backup period "on" or "off", empty = off

    1. Daily: every day, 7-day rotation
      dailyBackup="on"

    2. Weekly: the 1st, 8th, 15th and 22nd of month. 4-week rotation
      weeklyBackup="on"

    3. Monthly: first of each month, 3-month rotation
      monthlyBackup="on"

  • Path where the backup and log files are written, for pathBackup="/temp/backup" the files are on /temp/backup/save/ and /temp/backup/log/ No "/" at end of path, the path beetween "
    pathBackup="/aaa/bbb/ccc"

  • List of directorie(s) to backup (full path, each path separated by space) exexcluding website (see below)
    pathFileSave="/ddd/eee /fff/ggg /hhhh/ii"

  • List of website(s) path(s) to backup (full path, each path separated by space)
    pathSiteSave="/jjj/kkk/lll/mmmm /nnn/ooo/ppp/ttt"

  • Informations for database(s) backup(s) (each separated by space)
    syntax: "name_base1 user_base1 password_base1 name_base2 user_base2 ......."
    With Plesk you can use nupMysql="name_base1 admin `cat /etc/psa/.psa.shadow`"
    in this case don't forget the ` don't use " or ' but `
    nupMysql="db1 toto azerty db2 coco qwerty"

  • ftp login.
    ftplogin="juju"

  • ftp host. (IP or domain name)
    ftphost="xxx.xxx.xxx.xxx"

  • ftp port. (if empty ftpport = 21)
    ftpport=""

  • ftp pass word. No space!!!
    ftppw="azertyqwerty"

  • ftp backup root path on ftp server. Attention to the directories attributes vs user run the ftp connection
    ftproot="/uuu/vvv/www"

  • Mail server name host ( if empty mailhost = /etc/hostname )
    mailhost=""

  • Mail from: what you want. No space!!!
    mailfrom="system"

  • Mail to: more one adress is possible (each separated by semicolon, no space) if empty don't send mail !
    mailto="[email protected];[email protected]"

  • exec sendmail path ( if empty pathsendmail = /usr/sbin/sendmail )
    pathsendmail=""

After these parameters, you have on the config file:

#------------------- don't edit below -----------------------#
# Used for init or re-init the server ftp directories tree #
# For re-initialization delete "ftpServerInit='ok'" below #
# all data in the directory "ftproot" will be lost #
#------------------------------------------------------------#

Before initialization, below this block there are nothing
After initialization , you have:
#------------------- don't edit below -----------------------#
# Used for init or re-init the server ftp directories tree #
# For re-initialization delete "ftpServerInit='ok'" below #
# all data in the directory "ftproot" will be lost #
#------------------------------------------------------------#
ftpServerInit="ok"
Don't remove this latter line, otherwise hwsb reset the directory tree on the FTP server and losing backup files therein