Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: need a script to turn off a program, check for rsync

  1. #11
    Join Date
    Apr 2008
    Location
    US of A
    Beans
    23
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: need a script to turn off a program, check for rsync

    this is my script i made

    #!/bin/bash
    #Stop samba
    sudo /etc/init.d/samba stop
    #Wait for samba to stop
    sleep 15

    sudo rsync -v -g -o -p -a /srv/samba/ /media/Backup/

    #Wait for xx seconds after rsync has completed
    sleep 30
    #Restart samba
    sudo /etc/init.d/samba start


    if its any help

    does it use smbd instead of samba cause i think i read some where it does ill check this
    Last edited by plecebo.mc; July 19th, 2011 at 02:59 PM. Reason: added -v for verbose

  2. #12
    Join Date
    Apr 2008
    Location
    US of A
    Beans
    23
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: need a script to turn off a program, check for rsync

    ok i figured it out you have to use this:

    #!/bin/bash
    #Stop samba
    sudo stop smbd
    #Wait for samba to stop
    sleep 15

    sudo rsync -v -g -o -p -a /srv/samba/ /media/Backup/

    #Wait for xx seconds after rsync has completed
    sleep 30
    #Restart samba
    sudo start smbd
    Last edited by plecebo.mc; July 19th, 2011 at 03:03 PM.

  3. #13
    Join Date
    Sep 2009
    Location
    UK
    Beans
    435
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: need a script to turn off a program, check for rsync

    if rsync takes longer;
    Code:
    #!/bin/bash
    #Stop samba
    sudo stop smbd
    #Wait for samba to stop
    sleep 15
    
    sudo rsync -v -g -o -p -a /srv/samba/ /media/Backup/
    
    function meFinshed()
    {
        #Restart samba
        sudo start smbd
    }
    
    trap meFinshed EXIT
    My personal website with blog n apps
    http://www.mikejonesey.co.uk/

Page 2 of 2 FirstFirst 12

Tags for this Thread

Bookmarks

Posting Permissions

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