Nohup to continue running in the background after entering the password

Source: Internet
Author: User
Tags rsync

Linux/unix is a real multi-user, multitasking.
Linux provides FG and BG commands that let you easily schedule tasks that are running.

Suppose you find that a program running in the foreground takes a long time, but you need to do something else, you can hang up the program with Ctrl-z, and then you can see the system prompt:
[1]+ stopped/root/bin/rsync.sh
Then we can schedule the program to execute in the background: (the number behind BG is the job number)
#bg 1
[1]+/root/bin/rsync.sh &
Use the Jobs command to view the tasks that are running:
#jobs
[1]+ running/root/bin/rsync.sh &
If you want to bring it back to the foreground, you can use
#fg 1
/root/bin/rsync.sh
This way, you can only wait for the task to complete on the console.

& Throw instructions into the background to execute
[Ctrl]+z pauses the foreground task in the background
Jobs-l viewing the working status of the background
FG%jobnumber The backstage task to the front desk for processing.
BG%jobnumber put tasks in the background to handle
Kill management tasks in the background

Cases:

a:192.168.0.1 b:192.168.0.2

[A]nohup rsync-e ssh-avr/data1 192.168.0.2:/data1
nohup:appending output to ' nohup.out '
Password:

After entering the password, press: CTRL + Z
[1]+ Stopped nohup rsync-e ssh-avr/data1 192.168.0.2:/data1

Then enter it immediately:
[a]$ BG

The above command can then resume running in the background.
[1]+ nohup rsync-e ssh-avr/data1 192.168.0.2:/data1

Nohup to continue running in the background after entering the password

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.