Results 1 to 3 of 3

Thread: Scripting Rsync and Virsh

Hybrid View

  1. #1
    Join Date
    Aug 2012
    Beans
    8

    Scripting Rsync and Virsh

    Hi Guys

    Im having trouble scripting. I have never done scripting before and need desperately to get this going.

    I need to run the following commands in a script and then in a cron job.

    virsh suspend "VM"

    rsync --inplace ~/"vm disk" ~/NAS

    virsh resume "VM"

    Can anyone help please?

  2. #2
    Join Date
    Jan 2010
    Location
    Portugal
    Beans
    160
    Distro
    Ubuntu Development Release

    Re: Scripting Rsync and Virsh

    nano script.sh
    Place the commands inside the file

    Code:
    #!/bin/bash
    
    virsh suspend "VM"
    
    rsync --inplace ~/"vm disk" ~/NAS
    
    virsh resume "VM"
    
    exit 0
    give execute permission
    chmod +x script.sh
    Javali
    Administração e Desenvolvimento de Sistemas Informáticos, Lda.
    Open Source Systems / SugarCRM / Alfresco / Drupal / Openbravo
    http://www.javali.pt info at javali.pt

  3. #3
    Join Date
    Aug 2012
    Beans
    8

    Re: Scripting Rsync and Virsh

    Quote Originally Posted by HugoSerrano View Post
    nano script.sh
    Place the commands inside the file

    Code:
    #!/bin/bash
    
    virsh suspend "VM"
    
    rsync --inplace ~/"vm disk" ~/NAS
    
    virsh resume "VM"
    
    exit 0
    give execute permission
    chmod +x script.sh
    Thank you very much. I turns out i was quite close.

    I missed the "exit 0" bit and i should not have created it on windows first.

    But its working correctly thank you.

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
  •