ISPConfig 3 - back-res a Backup and Restore script

Discussion in 'Plugins/Modules/Addons' started by go0ogl3, Dec 6, 2009.

  1. go0ogl3

    go0ogl3 New Member


    ISPConfig 3 is a great piece of software. I want to contribute with a little script, maybe somebody will make a module and insert it in ISPConfig 3 if it's usefull.

    I use ISPConfig 3 in production on a small little used server and I have created a backup and restore script.
    I've tryied to make myself understood in the script. The script can be used to backup a full or partial linux system with a full mysql dump.
    My script is using only one full backup a month, the rest are incremental backups. This uses less space and less ressources. There are some drawbacks, but I haven't find anything like this on the net, so I created this little script and I hope I will have more time to make it better later.
    For now this script is in a "It works for me" state, but I think it can be used safely if the user takes his time and reads all the info in the script header.

    The link:

    Thank you for good free software!
  2. nokia80

    nokia80 Member HowtoForge Supporter

    things to do


    beautiful script can explain you maby which codes must use you to manage script for backup and also for put back where script must come etc......:confused:

    sees good nice
  3. go0ogl3

    go0ogl3 New Member

    For backup the script is used without any arguments and it's supposed to be run from cron from a line like:
    40 3 * * * /etc/back-res 1>/dev/null 2>/dev/null

    Please read the info in the first lines of the script. I've tried to explain how the script functions there. If you have more questions please ask.
  4. Snake12

    Snake12 New Member

    Hi, i have a problem on my server (Ubuntu 8.04.3 LTS) with your script.

    admin@serverWeb:/root$ sudo ./back-res
    df: `/bck/': No such file or directory
    df: no file systems processed
    ./back-res: line 230: [: -gt: unary operator expected
    mkdir: cannot create directory `/bck/': No such file or directory
    ./back-res: line 167: /bck/ No such file or directory
    ./back-res: line 173: /bck/ No such file or directory
    mkdir: cannot create directory `/bck/': No such file or directory
    ./back-res: line 167: /bck/ No such file or directory

    can u help me ?

    Last edited: Dec 13, 2009
  5. skoena

    skoena Member HowtoForge Supporter

    I runned the script but it hangs and gives me some errors. Can somebody tell me what they mean?


    EDIT: I executed the script on another (my new) server and here no error messages.
    Last edited: Dec 14, 2009
  6. skoena

    skoena Member HowtoForge Supporter

    What's the easiest or best way to backup to an existing Windows 2003 server?

    Should I do this with a mount? Or use FTP to upload the files to the server? Or are there better ways to do this? Please advise.
  7. go0ogl3

    go0ogl3 New Member

    You need to configure corectly the backup dir, line 107 from the script, "BACKUPDIR" variable. It's the place where to store the backups and it must exist.

    P.S.: sorry for the delay in answer, hope will help you!
  8. go0ogl3

    go0ogl3 New Member

    Please read carefully the comentaries on the script. The script tries to backup the directories from the "DIRECTORIES" variable in line 100.
    You do not have the /adm directoy that it's why you get the error:
    /bin/tar: /adm: Cannot stat: No such file or directory
    The other errors are because the file are modified by external programs when tar tries to archive them (syslog and console-kit in your case). The last errors are because the files are actually sockets, not real files. You can use the "EXCLUDED" variable, in line 102 of the script, to exclude files (sockets) or directories you do not wish to backup.

    P.S.: Sorry for the delay in answer, I have been verry busy in the year end.
  9. go0ogl3

    go0ogl3 New Member

    It's a simple answer. Let's take the two cases you provided:
    1. you have a linux server on wich you run the backup script and you mount a samba share from Windows 2003 server:
      The script gets the larger files and archives them locally on the server and consumes the bandwith twice (with the S = sparse tar argument) to read the
      files from the Windows 2003 share. So if the share is 1Gb the bandwith consumed is 2Gb and the archive can take longer to make compared to the second case.
    2. you have a linux server on wich you run the backup script and you already have uploaded the files you wish to archive, 1Gb worth of files, 1Gb bandwith used.
      The script takes less to archive files (they are accesed localy) and the bandwith consumed is 1Gb.


    • Those two cases are good if you want to keep the Windows 2003 backup on the linux server. This is good, you have data redundancy :cool:
      If the linux and Windows are on a local lan both metoths are good. If the computers are on the internet, the first case it's not so good, it consumes more resources.

    P.S.: Hope this helps you! Sorry for the delay... too much work.
  10. HyperAtom

    HyperAtom New Member

    Amazing script, works like a charm thanks go0ogl3 :)
  11. jmp51483

    jmp51483 New Member

    Would you mind giving me a hand??

    I'm receiving the following error when trying to use your script... any ideas??

    ./back-res: line 238: [: -gt: unary operator expected
    note : The storage engine for the table doesn't support optimize
    note : The storage engine for the table doesn't support optimize
  12. go0ogl3

    go0ogl3 New Member

    Optimize not suported by the database

    This is because that particular database is not supporting the optimize option of mysql. This is an error which does NOT really interfere with the backup option, the database is still backed up, you can check this by looking at the database archive from that day.

    This appears because I've included an optimize function of all databases before back up.
  13. go0ogl3

    go0ogl3 New Member

    You welcome!
  14. jmp51483

    jmp51483 New Member

    Hey thanks for the response!

    I was more a bit worried about this part

    ./back-res: line 238: [: -gt: unary operator expected

    Line 238 has to do with:

    if [ "$pfs" -gt "$maxp" ] ;then

    Is this rendering the space check inoperable??

    Thanks for this script though, it's amazing!
  15. jmp51483

    jmp51483 New Member

    Would this work if I built another server completely identical, and then copied the files from one to the other... and restored.. almost creating a mirror situation?
  16. bseibenick

    bseibenick New Member

    I am getting the "./back-res: line 238: [: -gt: unary operator expected" error as well.

    I am running CentOS 5.4 if that helps.

    Things seem to be backing up...

  17. go0ogl3

    go0ogl3 New Member

    It's possible to render the space check inoperable. I'm not sure why you get this message. This error happens only if one of the $pfs or $maxp is inexistent, is not a number, or is a decimal number (ex: 10.5)

    I've tested this script on Ubuntu 9.04 and 9.10 and more versions of Slackware (10.2 up to 13.0) and it's working as expected, no errors.
    If you can read this: and use "set" to see where the error is, post it here and I'll try to make the script better if I can.

    Thank you for using this script and for providing feedback.

    Edit: Can you please tell me what linux are you using? This will help me I hope to make the script better and more portable.
    Last edited: Feb 11, 2010
  18. go0ogl3

    go0ogl3 New Member

    If you don't forget some usefull dir the response is yes. Be carefull to NOT include the /proc or other stuff which is automagically created at kernel start.

    Thank you for feedback.
  19. go0ogl3

    go0ogl3 New Member

    I hope I'll have some time in this weekend to improve the script. I'm downloading CentOS and I will test the script to see what I'm missing. I think it must be something related to the bash settings used.

    Thank you for your time.
  20. jmp51483

    jmp51483 New Member

    I am currently running Ubuntu 9.10. I will follow up with more shortly.

Share This Page