RE: Script not terminating properly
"Geoffrey Scott" <[email protected]>
| Newsgroups | gmane.org.user-groups.mlug.main |
|---|---|
| Message-ID | <[email protected]> |
I should have given more info shouldn't I..... this is the script on the backup server that calls the other on the mail server: #!/bin/bash /usr/bin/ssh [email protected] /root/scripts/PrepareForRsync2Fpmelb.sh --stop echo "OK. Now we rsync the selected directories" /usr/bin/rsync -Razor --delete --files-from=/root/scripts/mailRsyncFiles.txt \ mail.guestshire.com:/ /home/backup/mail/ /usr/bin/ssh <mailto:[email protected]> [email protected] "/root/scripts/PrepareForRsync2Fpmelb.sh --start" echo "this is the final line from fpmelb's backupmail script" So the --stop part of the script successfully completes, then the rsync, then the --start part to start the services again, then it hangs and never hands the shell prompt back to the backup server. unfortunatley I tried your suggestion and it still hangs......... Regards Geoff Scott _____ From: [email protected] [mailto:[email protected]] On Behalf Of Will Wheatley Sent: Thursday, 3 November 2005 5:09 PM To: Melbourne Linux Users Group Subject: Re: [MLUG] Script not terminating properly Hi, What i think is happening..... one of the scripts you are calling is spawning a child process (obviously as it is starting your process :) The bash process that is processing your script is actually waiting for one or more child processes to exit, so it seems to hang... I would think its the following line /root/scripts/dumpOXexpectScrpt.exp /var/backups/openexchangedb.out \ $DEFAULT_SQL_DB $DEFAULT_SQL_USER $DEFAULT_SQL_PASS only because the init.d scripts usually spawn correctly :) you could try putting a & at the end of the line above .... and seeing if it still hangs? On 11/3/05, Geoffrey Scott <[email protected]> wrote: Russell Shaw wrote: > Geoffrey Scott wrote: >> Hi ppl, >> I can't for the life of me figure out why this script below doesn't >> finish. Can anyone see what I have done wrong? >> >> #!/bin/bash >> . /usr/local/open-xchange/etc/admintools.conf >> >> if [ "$1" = "--stop" ] >> then... > > It's easiest to put: echo "passNNN" statements on every few lines. > That's what I did when I stuck in the echo `date` echo "all done" Lines at the end. It gets to echoing "all done" and then stops. This script is actually called from my main backup server, hence the --start and --stop. Regards Geoff Scott _______________________________________________ Melbourne Linux Users Group (Australia) Edit your settings: http://lists.mlug.org.au <http://lists.mlug.org.au>