I use this to run rsync in background
rsync -avh /home/abc/abac /backups/ddd &
When i do that i see line saying 1 process stopped.
Now does that mean my process is still running ot it is stopped
The solution to keep rsync running in backgroundNohup allows to run a process/command or shell script to continue working in the background even if you close the terminal session. In our example, we also added '&' at the end, that helps to send the process to background.
There are two different approaches to have rsync running as a daemon, one is to launch the program with the --daemon parameter, and the other is to have inetd or xinetd to launch rsync and have it running as the other services that inetd and xinetd handles. But first, we must configure the file /etc/rsyncd.
Use bg to Send Running Commands to the Background You can easily send such commands to the background by hitting the Ctrl + Z keys and then using the bg command. Hitting Ctrl + Z stops the running process, and bg takes it to the background. You can view a list of all background tasks by typing jobs in the terminal.
When you press "ctrl + z" then the process stopped and go to background.
[1]+ Stopped rsync -ar --partial /home/webup/ /mnt/backup/
Now press "bg" and will start in background the previous process you stopped.
[1]+ rsync -ar --partial /home/webup/ /mnt/backup/ &
Press "jobs" to see the process is running
[1]+ Running rsync -ar --partial /home/webup/ /mnt/backup/ &
If you want to to go in foreground press "fg 1" 1 is the process number
nohup rsync -a host.origin:/path/data destiny.host:/path/ &
Nohup allows to run a process/command or shell script to continue working in the background even if you close the terminal session.
In our example, we also added ‘&’ at the end, that helps to send the process to background.
nohup rsync -avp [email protected]:/root/backup/uploads/ . &
[1] 33376
nohup: ignoring input and appending output to 'nohup.out'
That’s all, now your rsync process will run in the background, no matter what happens it will be there unless you kill the process from command line, but it will not be interrupted if you close your linux terminal, or if you logout from the server.
cat nohup.out
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With