All the content is collected in the network, part of the simple translation
First, use screen to execute commands
nohup
&
The command executes after the command is executed in the background, even if you exit the login. However, you cannot reconnect to this session, and to reconnect to this session, you can use the screen
command as described in the previous article.
The Linux Screen command provides the ability to detach and reconnect a session. When you reconnect to this session, your terminal is exactly the same as when you were separated.
For more information, please refer to this article screen Command examples:get Control of Linux/unix Terminal
Ii. using at to execute a command as a batch
With at
commands, you can have a command run at a specified date and time, for example, to execute the backup script in the background at 10 o'clock in the morning tomorrow, and execute the following command:
$ at -f backup.sh 10 am tomorrow
Please refer to this article for details understand at, ATQ, ATRM, batch Commands using 9 Examples
Some of the tasks that you perform in batch mode require some options to be enabled. The following article will give a detailed explanation:
- How-to-Capture Unix Top Command Output to a File in readable Format
- Unix BC Command Line Calculator in Batch Mode
- How-to-Execute SSH and SCP in Batch Mode (if passwordless login is enabled)
Third, use watch to execute a command continuously
To execute a command continuously at a fixed interval, you can use the watch
command as follows:
$ watch df -h
Please refer to this article for more information watch:repeat Unix Commands or shell-scripts every N seconds
Iv. killing process
Killing a program that has already started is the same as the normal way:
- Pkill-9 Name
- Killall Name
- Kill PID
Finish
Linux command background Run tricks (3)