I hopethis hope this makes sense. How do you make rsync run even when not physically connected to the server? In other words, I run rsync from the terminal via vnc and when I log out of the connection, rsync stops running. Is there a script or something I can use? Sent from my iPhone
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Use screen or tmux. You can start rsync (or anything else) running then detach. Later you can log back in and re-attach. On 04/11/12 22:05, Chris Arnold wrote:> I hopethis hope this makes sense. How do you make rsync run even > when not physically connected to the server? In other words, I run > rsync from the terminal via vnc and when I log out of the > connection, rsync stops running. Is there a script or something I > can use? > > Sent from my iPhone- -- ~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~ Kevin Korb Phone: (407) 252-6853 Systems Administrator Internet: FutureQuest, Inc. Kevin at FutureQuest.net (work) Orlando, Florida kmk at sanitarium.net (personal) Web page: http://www.sanitarium.net/ PGP public key available on web site. ~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~ -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk+GOM0ACgkQVKC1jlbQAQdnuQCgjEWWux7uqcpDgjUWFeBL2CkN qXcAn3+9vIe46JvdwCjPDPtcRLNiVZol =Sg0J -----END PGP SIGNATURE-----
On Wed, 11 Apr 2012, Chris Arnold wrote:> I hopethis hope this makes sense. How do you make rsync run even when > not physically connected to the server? In other words, I run rsync from > the terminal via vnc and when I log out of the connection, rsync stops > running. Is there a script or something I can use? >man screen (manually as a user) or use a cron job Lee
On 4/11/2012 10:05 PM, Chris Arnold wrote:> I hopethis hope this makes sense. How do you make rsync run even when not physically connected to the server? In other words, I run rsync from the terminal via vnc and when I log out of the connection, rsync stops running. Is there a script or something I can use? > > Sent from my iPhoneWell, vnc is already itself one way, it just depends how you have vncserver, xvnc, and your desktop session set up and how you are disconnecting. It's possible to disconnect from a vnc session without closing the desktop session. In that case rsync wouldn't stop any more than any other thing running in that session. nohup or screen are the usual answers for this though, not just for rsync or vnc. If you don't care about seeing the output while it's running: nohup someprogram options... & The output is written to nohup.out by default so you can tail -f thatto check ongoing progress or cat/less it later when all done. Myself I like to use screen. screen -S foo That doesn't look like it did anything but it did. You are now in a screen session named foo. You can put whatever you want for "foo" it's just a name you make up for the session so that it's easier to recognize and reconnect to later. So in this case you might say screen -S rsync or screen -S rsync_targetmachine Now just run the rsync command. no nohup, no &. Now rsync is chugging along, press ctrl-a then d to detach from the screen session. rsync is still running in that screen session, just you are no longer attached to that screen session. Now you can log out, go somewhere else, connect back from somewhere else, get a new shell, list all screen sessions: screen -ls you'll likely only have the one you created unless it's a multiuser system and someone else uses screen. It'll say "chris 24371.foo" To reattach to that session: scree -r foo Now you'll either see the ongoing rsync, or you'll see the final summary messages and a new shell prompt. If rsync is still running, just ctrl-a d again. If rsync is done and you're done with that screen session, you should type exit at the shell prompt from within the screen session, (instead of pressing ctrl-a d to detach) that will exit that shell and close and destroy the screen session. You'll be back at the parent shell and screen -ls will show no sessions. man/google nohup and gnu screen -- bkw
On Apr 11, 2012, at 10:48 PM, "Brian K. White" <brian at aljex.com> wrote:> Now just run the rsync command. no nohup, no &.Just so completely understand, it should be: rsync --options xxxxx no nohup no & Or am I completely wrong? Btw, Brian K. White, that looks familiar. You a member of the opensuse or postfix lists?
it has not been mentioned: nohup ! screen is a bit complicated if you never used it. It only makes sense if you want to check back later and see life what is going on. at or cron would be my last restort. nohup would be my choice nohup (you command and options) & Example: x at x:~> nohup ls -la & [1] 12865 x at x:~> nohup: ignoring input and appending output to `nohup.out' [1]+ Done nohup ls -la You can do a tail -f on nohup.out after you started the job to see what it would output on the screen. Other example: nohup (your command and options) >> log.rsync 2>>&1 & will output stdout and stderr to the log.rsync regards, Joachim Otahal Chris Arnold schrieb:> I hopethis hope this makes sense. How do you make rsync run even when not physically connected to the server? In other words, I run rsync from the terminal via vnc and when I log out of the connection, rsync stops running. Is there a script or something I can use? > > Sent from my iPhone
On 4/12/2012 3:36 PM, Joachim Otahal (privat) wrote:> it has not been mentioned: nohup !Yes it was. -- bkw