Help with bash script

Fajar Priyanto fajarpri at cbn.net.id
Sun Mar 26 06:16:17 UTC 2006


Hi all,
I want to do an rsync of my qmailtoaster directory 
(/home/vpopmail, /var/qmail, etc) from another machine.

Since this involves several directory, can anyone help me how to make the bash 
script so that the second rsync command will wait util the first rsync 
command finishes? I think we can use sleep command, but I'm sure there is 
more appropriate ways (such as using exit code?)

I imagine the script will be like this (pls mind the word wrap):
#!/bin/bash
rsync -avzgorp --delete -e ssh root at 192.168.1.200:/var/qmail/ /var/qmail/
if ok then:
rsync -avzgorp --delete -e ssh 
root at 192.168.1.200:/home/vpopmail/ /home/vpopmail/
if ok then:
rsync -avzgorp --delete -e ssh 
root at 192.168.1.200:/var/log/qmail/ /var/log/qmail/
if ok then:
rsync -avzgorp --delete -e ssh 
root at 192.168.1.200:/var/log/maildrop/ /var/log/maildrop/
if ok then:
rsync -avzgorp --delete -e ssh root at 192.168.1.200:/etc/mail/ /etc/mail/
if ok then:
rsync -avzgorp --delete -e ssh 
root at 192.168.1.200:/.spamassassin/ /.spamassassin/
if ok then:
rsync -avzgorp --delete -e ssh 
root at 192.168.1.200:/etc/tcprules.d/ /etc/tcprules.d/
fi
done

Thank you very much,
-- 
Fajar Priyanto | Reg'd Linux User #327841 | Linux tutorial 
http://linux2.arinet.org
12:26:40 up 3:16, 2.6.15-1.1830_FC4 GNU/Linux 
Let's use OpenOffice. http://www.openoffice.org




More information about the fedora-list mailing list