I have to kill the process "test" for a maintenance I do but want the script to check when it comes back up.
I can get what I want when I run this while loop:
while true;do ps -ef | grep test | grep -v grep | sed -e 's/^[ \t]*//';sleep 60;done
but I want the script to do it for me and as soon as the process is found I would like for it to exit. Please advise.
---------- Post updated at 02:43 AM ---------- Previous update was at 12:57 AM ----------
Nevermind I was able to figure it out.
I can get what I want when I run this while loop:
while true;do ps -ef | grep test | grep -v grep | sed -e 's/^[ \t]*//';sleep 60;done
but I want the script to do it for me and as soon as the process is found I would like for it to exit. Please advise.
---------- Post updated at 02:43 AM ---------- Previous update was at 12:57 AM ----------
Nevermind I was able to figure it out.
Code:
TESTSTATUS=`ps -ef | grep test | grep -v grep | sed -e 's/^[ \t]*//'`
echo
echo
echo "\033[1;37 \033[1mAs soon as Test processes comes back up it will appear below:\033[0m\n"
until [[ -n $TESTSTATUS ]];do ps -ef | grep test | grep -v grep | sed -e 's/^[ \t]*//';done