Community Forums Today's Posts     Member List     Archive    
Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2011
    Location
    Baghdad, Iraq
    Posts
    90

    Using Snapshot scripts for daily backup ?

    Hello

    since i just fixed my server database and saved myself from a total remake of 74 channel and 13 group and lots of extra permissions -.-

    i want to set the Snapshot pull script to automatic daily backup

    but since am not experienced Linux shell user i need help with this

    how can i set a script to auto run the
    Code:
    ./pullsnapshot.sh serveradmin 123213123ggadsa213 voice.teamspeak-systems.de 10011 backup.txt 1
    - Run every 24 hour.
    - Set the backup.txt file name to something like backup_[date&time].txt.
    - Store the backup files in specified folder.

    so whats the best code / script to use ?

    Thanks

  2. #2
    Join Date
    May 2010
    Posts
    6,372
    Hello

    You can use this script :
    Code:
    #! /bin/sh
    
    #Path of the backup folder (absolute path)
    BACKUP_PATH=/home/florian/backup
    
    #Name of the snapshot file
    FILE_NAME=backup_`date  +%Y-%m-%d_%H-%M-%S`.txt
    
    
    ./pullsnapshot.sh serveradmin florian 192.168.1.100 10011 ${FILE_NAME} 1
    
    mv ./${FILE_NAME} ${BACKUP_PATH}/${FILE_NAME}
    About the path, you have to write the absolute path (not ./backup but /home/florian/backup)

    About the date format, for more information open the help : man date

    How to use it :
    • Put this script in the same place of the pullsnapshot.sh
    • Add the exec right : chmod 744 cronsnapshot.sh


    For test you can start it manualy : ./cronsnapshot.sh

    Now to start it evry 24 hours :
    For that you have to use the cron system (more info on google or man crontab)

    • Open the cron tab : crontab -e
    • Add this line : 0 0 * * * /home/florian/cronsnapshot.sh

    0 0 to start script at midnight (0h00) You can chage for another specific hour
    * * * for evry day, month
    Attached Files Attached Files
    Last edited by florian_fr40; 12-08-2011 at 00:03.

  3. #3
    Join Date
    Jun 2011
    Location
    Baghdad, Iraq
    Posts
    90
    Thanks


  4. #4
    Join Date
    Jun 2011
    Location
    Baghdad, Iraq
    Posts
    90
    something is wrong here .. when i test the script i get

    Code:
    root@30003038:/home/teamspeak# sh ./cronsna.sh
    : not foundh: 2:
    : not foundh: 5:
    : not foundh: 8:
    : not foundh: 9:
    [: 80: 0: unexpected operator
    [: 80: 0: unexpected operator
    [: 80: 0: unexpected operator
    [: 80: 0: unexpected operator
    [: 80: 0: unexpected operator
    [: 80: 0: unexpected operator
    [: 80: 0: unexpected operator
    snapshot.txt file being written to as we speak? Something is very wrong here...
    exit: 80: Illegal number: -9
    : not foundh: 11:
    mv: cannot move `./ts_backup_2011-08-11_18-01-42.txt\r' to `/home/teamspeak/backup\r/ts_backup_2011-08-11_18-01-42.txt\r\r': No such file or directory
    using Ubuntu server

    cant move or even delete the backup.txt files

  5. #5
    Join Date
    May 2010
    Posts
    6,372
    I remade the script. It should work normaly now.

    If you use Windows to download it before put it on Linux system, this can cause this problem.
    Use wget on linux.
    Last edited by florian_fr40; 12-08-2011 at 11:13.

  6. #6
    Join Date
    Jun 2011
    Location
    Baghdad, Iraq
    Posts
    90
    What i did was edited the script added "bash" before the pull....sh

    Code:
    #! /bin/sh
    
    #Path of the backup folder (absolute path)
    BACKUP_PATH=/home/teamspeak/backup
    
    #Name of the snapshot file
    FILE_NAME=backup_`date  +%Y-%m-%d_%H-%M-%S`.txt
    
    
    bash ./pullsnapshot.sh serveradmin florian 192.168.1.100 10011 ${FILE_NAME} 1
    
    mv ./${FILE_NAME} ${BACKUP_PATH}/${FILE_NAME}
    but still got errors when using crontab so fixed by adding the full path to the pullsnapshot.sh like :

    Code:
    bash /home/ahmed/backup/pullsnapshot.sh serveradmin florian 192.168.1.100 10011 ${FILE_NAME} 1
    and now it works like charm

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. snapshot helper scripts
    By Peter in forum Server Support
    Replies: 25
    Last Post: 06-05-2013, 14:34
  2. snapshot helper scripts
    By Peter in forum Linux / FreeBSD
    Replies: 0
    Last Post: 08-02-2010, 15:47
  3. Connection problems after daily IP reset
    By GAGA Extrem in forum Windows
    Replies: 0
    Last Post: 21-12-2009, 11:50
  4. Crashing Daily
    By Thalador in forum [TeamSpeak 2] Server Support
    Replies: 4
    Last Post: 18-04-2005, 19:38

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •