The shell script developed has a section to determine if the process is started and the code is as follows
Start Cadvisor fail
Logic is fine, but always returns after the NAS executes
Start Cadvisor fail
After logging into the machine, the PS aux can be used to check that the process is actually started, and that executing the script on the machine is also successful.
Increase printing, and then call the NAS interface execution, found that the process name has been truncated, such as the Docker process after the parameters are all gone, but the cadvisor process, is displayed asroot 3242 2.0 0.3 78148 6308 ? Sl 20:50 0:00 /usr/local/bin/
Root2924 0.1 0.0 9420 1576? S -: - 0:xxBash v2.0/node-Root3166 2.8 0.5 259720 11948? Sl -: - 0:xx/usr/bin/Dockerroot3173 0.0 0.0 0 0? s< -: - 0:xx[Loop0]root3174 0.0 0.0 0 0? s< -: - 0:xx[Loop1]root3175 0.0 0.0 0 0? s< -: - 0:xx[Kdmflush]root3177 0.0 0.0 21248 868? S -: - 0:xxUDEVD--Daemonroot3178 0.0 0.0 21248 992? S -: - 0:xxUDEVD--Daemonroot3180 0.0 0.0 0 0? s< -: - 0:xx[Bioset]root3181 0.0 0.0 0 0? s< -: - 0:xx[Kcopyd]root3182 0.0 0.0 0 0? s< -: - 0:xx[Bioset]root3183 0.0 0.0 0 0? s< -: - 0:xx[dm-Thin]root3184 0.0 0.0 0 0? s< -: - 0:xx[Bioset]root3242 2.0 0.3 78148 6308? Sl -: - 0:xx/usr/local/bin/Root3250 0.0 0.0 15312 1128? R -: - 0:xx PSAux
The output of this thing is not the same as the terminal, may set the length of the display when using the NAS and directly in the terminal is not the same
Print the next
Executed directly on the machine setty -a
and echo $COLUMNS
the results are as follows
#setty-384000; #echo $COLUMNS $
When using the NAS call script, increase the value of printing columns, the result columns=80
The columns is set to 80 directly on the machine, resulting in the problem of truncation being reproduced.
#export columns= the#PSAuxroot3520 0.6 0.9 120996 20164? Sl -: - 1: on/usr/local/bin/Root3595 0.2 0.9 32480 20040? Sl -: - 0: A/usr/local/bin/Root7165 0.0 0.0 35728 1140? S the: the 0:xx/usr/sbin/Cronroot7166 0.0 0.0 35728 1144? S the: the 0:xx/usr/sbin/cron
It seems that because of the limitation of the character length, the ghost knows the environment variables of the NAS inherit from WHO.
If you need to solve the PS display process length truncated problem, the method is also more, you can modify the next PS command to output long enough, man PS a bit, found this w parameter
-w Wide output. for Unlimited width. --width n Set screen width.
After appending ww
the parameters, the script executes normally.
People who write shell scripts often encounter large pits such as environment variables, so try to choose a secure implementation or to circumvent such problems by setting their own environment variables.
PS caused by the massacre