Tag: Kill cal load requires Roo quote Ora loop one
Wrote a monitoring load of a smallScript(Dead Cycle,TestKill the corresponding process after the end), because you need to monitor more than one server, so on a single server to useSSHUnifiedExecutionScript
Problems encountered:
using SSH [email protected] '/usr/local/luly/loadavg.sh 2 2 & ' execution
The machine does not immediately exit, occupying SSH connection
The intention is to send commands toRemoteThe machine executes, the native sends after the direct exit
Try:
1, increase nohup, the effect is the same:
SSH [email protected] ' nohup/usr/local/luly/loadavg.sh 2 2 & '
2, increase the network said T,-TT parameters, also no use
ssh-t [email protected] '/usr/local/luly/loadavg.sh 2 2 & '
SSH-TT [email protected] '/usr/local/luly/loadavg.sh 2 2 & '
3, remove the quotation marks, the machine is also inBackstageRun, use SSH connection, must kill the line manually, not what I think
SSH [email protected]/usr/local/luly/loadavg.sh 2 2 &
Final Solution:
Add >/dev/null 2>&1, native Instant exit, no process left, remote background execution script, to achieve the purpose
SSH [email protected] '/usr/local/luly/loadavg.sh 2 2 >/dev/null 2>&1 & '
To monitor the load script:
# cat loadavg.sh#!/bin/Bashusage="Usage: $ second filename"if[$#-ne2 ]; Then echo $USAGE exit1fi>/tmp/monitor/loadavg/146.20_loadavg_$2. Log while[[1=1 ]] DoUptime>>/tmp/monitor/loadavg/146.20_loadavg_$2. Log Sleep $1 Done
LINUX-SSH Remote Background Execution script-place background execution problem (GO)