Find the answer to your Linux question:
Results 1 to 1 of 1
Hi, I have a little problem that I canīt seem to find the solution, I have a simple script that what it does is: Stop Services Tar some folders Log ...
  1. #1
    Just Joined!
    Join Date
    Sep 2009
    Posts
    1

    Backup Script.... Help needed.....

    Hi, I have a little problem that I canīt seem to find the solution,

    I have a simple script that what it does is:

    Stop Services
    Tar some folders
    Log in to an FTP
    PUT the Tar Folders on the FTP server (2003)
    Remove the previously created tars
    Start the Services Again.

    But here is the problem, if the Tars, Log in and Put work fine the services do start up ok, but if I get any problem, the script dies, and the services donīt come back up.

    So How can I modify this script so that if it fails the Backup procedure, still start the services up anyway, because they are very important "MYSQL and CVSD")

    Here is a Copy of the Script:

    Code:
    #!/bin/bash
    
    cd /root
    
    /etc/init.d/cvsd stop
    /etc/init.d/mysql stop
    
    tar czvf source_`date +%y%m%d.tar.gz` /home/source/*
    tar czvf mysql_`date +%y%m%d.tar.gz` /var/lib/mysql/*
    
    
    ftp -inv 192.168.1.2 << EOF
    user user1 backup
    verbose off
    prompt off
    binary
    put source_`date +%y%m%d.tar.gz`
    put mysql_`date +%y%m%d.tar.gz`
    
    
    bye
    EOF
    
    rm source_`date +%y%m%d.tar.gz`
    rm mysql_`date +%y%m%d.tar.gz`
    
    /etc/init.d/mysql start
    /etc/init.d/cvsd start
    Any help will be really appreciated,

    Many thanks in advance!...
    Last edited by greenberet88x; 09-23-2009 at 08:27 AM. Reason: Need to change the title

Posting Permissions

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