在后台挂起一个bash脚本。

时间:2021-01-07 00:09:11

I have a bash script running in the background, and it executes in a loop every 5 seconds. This effects the commands that are being executed at the shell itself.

我有一个在后台运行的bash脚本,它每5秒执行一次循环。这将影响在shell本身执行的命令。

Is there a way, i can suspend the script execution until the shell is not executing other commands.

如果有办法,我可以暂停脚本执行,直到shell不执行其他命令。

thanks

谢谢

2 个解决方案

#1


3  

to stop the scipt you can use

要停止可以使用的scipt

kill -s STOP $PID

where $PID contains the process ID of the script. To start it again, you use

其中$PID包含脚本的进程ID。要重新开始,需要使用

kill -s CONT $PID

#2


0  

Renice should help in such scenario. Using renice you can decrease/increase the priority of the process. Look man page for more detailed help.

Renice应该在这种情况下提供帮助。使用renice可以减少/增加进程的优先级。查看手册页获得更详细的帮助。

#1


3  

to stop the scipt you can use

要停止可以使用的scipt

kill -s STOP $PID

where $PID contains the process ID of the script. To start it again, you use

其中$PID包含脚本的进程ID。要重新开始,需要使用

kill -s CONT $PID

#2


0  

Renice should help in such scenario. Using renice you can decrease/increase the priority of the process. Look man page for more detailed help.

Renice应该在这种情况下提供帮助。使用renice可以减少/增加进程的优先级。查看手册页获得更详细的帮助。