Hi, >> Your ssh isn't exiting because a child process, in this case zimbra, >> remains. As some others have suggested, this is due to ssh waiting on both >> stdin and stdout of the child process to close.
> or, more clear, for *any process* that has the pseudo tty allocated by ssh > opened to close these file descriptors. That usually includes any background > processes started as in the example below, unless you redirect their > stdin, stdout, and stderr. >> For example, if you do the following, you'll experience a hang: >> pc1$ ssh pc2 >> pc2$ xterm & >> pc2$ logout >> ...hang without exit.. until you close the xterm. > (tip: type <Enter>~# to see why (where <Enter> is the enter key on your > keyboard ;-)). >> Something like the following should behave more like you expect: >> pc1$ ssh pc2 >> pc2$ xterm < /dev/null >& /dev/null & >> pc2$ logout >> ...ssh session terminates >> pc1$ > While basically correct, the example is not good, as this exact sequence of > commands would tunnel the X11 connection through ssh, preventing the ssh > session to terminate until the xterm is closed much in the same way as > without redirection (except that now it's the X11 connection that is still > open). The correct example would be something like: > pc1$ ssh pc2 > pc2$ xterm -display pc1:0.0 < /dev/null >& /dev/null & > pc2$ logout > ... ssh session now really terminates :-) > pc1$ > ... except that you *may* have to think about XAUTHORITY issues (I'll save > you the details as it's not really interesting in the context of BackupPC). > It's really more like > pc1$ ssh pc2 > pc2$ start-some-non-interactive-daemon-process < /dev/null >& /dev/null & > pc2$ logout > ... ssh session terminates > pc1$ > In regard to the original question: >> zimbra_post_back.sh: >> #!/bin/sh >> >> my_date=`date +%Y-%m-%d` >> my_time=`date +%H:%M:%S` >> echo "Starting time: $my_time" >> /opt/zimbra/backup/zm_backup-$my_date.log >> su - zimbra -c "/opt/zimbra/bin/zmcontrol start" | tee -a >> /opt/zimbra/backup/zm_backup-$my_date.log >> my_time=`date +%H:%M:%S` >> echo "Successfully started Zimbra at $my_time" >> exit 0 > as you want some output to appear in the BackupPC log file, you'll need to > modify /opt/zimbra/bin/zmcontrol to start the processes it starts with > redirected stdin/-out/-err. Alternatively, you could try something like: --- zimbra_post_back.sh cut here --- #!/bin/sh my_date=`date +%Y-%m-%d` my_time=`date +%H:%M:%S` my_log=/opt/zimbra/backup/zm_backup-$my_date.log echo "Starting time: $my_time" >> $my_log su - zimbra -c "/opt/zimbra/bin/zmcontrol start" < /dev/null >>& $my_log cat $my_log my_time=`date +%H:%M:%S` echo "Successfully started Zimbra at $my_time" exit 0 --- /zimbra_post_back.sh --- > This should show you the part of the output generated during the time > zmcontrol runs, while restricting any later output to the log file. > Actually, you don't expect any later output. Otherwise, you wouldn't be > wondering about ssh not terminating :-). > Regards, > Holger Thanks a lot for your help! That worked for me... The SSH connection is now closed after the end of the script and the backup can complete. Regards, Tobias ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ BackupPC-users mailing list BackupPC-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/backuppc-users http://backuppc.sourceforge.net/