I'm connecting from my computer to a HP UX B.11.31 system and am running some very lengthy there commands using nohup so I can go to sleep and do something else for a few days while they complete.
Example of such a command:
nohup rsync --rsync-path=/usr/local/bin/rsync -e ssh /data/src usr@target:/data/ >> /data/log/sync.out 2>&1 &
Note: the Rsync command's target is a different HP UX server.
It'll run and run, until my computer somehow gets disconnected from the HP UX system (it's connected through SSH over a VPN over my home connection, and disconnections seem to happen once a day).
If this has happened, I can tail /data/log/sync.out
and I'll find:
Killed by signal 1.
rsync error: unexplained error (code 255) at rsync.c(549) [sender=3.0.8]
Someone suggested putting the command in a shell script and running that with nohup instead.
So I did that (with a shebang for #!/usr/bin/bash
), and then ran the command as nohup ./auto_rsync.sh > /data/log/sync.out 2>&1 &
.
The same thing happened.
The funny thing is that if I simply log out while the command is running by typing exit
, the command will keep running. So why is only my disconnect sending SIGTERMs to a process running with nohup?
rsync
dies when your connection disappears?rsync
fail, as opposed to something causing both your SSH connection and the rsync-over-SSH connection between the two servers to fail at the same time?