I am trying to create one script which check for a running process and start it if it is not running.
Here is test.sh
#!/bin/bash
if pgrep infiloop > /dev/null ;
then
echo "Process is running."
else
exec /u/team/infiloop.sh > /u/team/infiloopOutput.txt
echo "Process was not running."
fi
And infiloop.sh
#!/bin/sh
while true
do
echo "helllo"
sleep 2
done
Now when i run the 1st script , it starts the script but after it start it doesn't allow me to run another command.
Output:
[user@host ~]$ ./checkforRunningJob.sh
^C
I have to press Ctrl+C, Ctrl+Z, and once i do that my infinite script also stop.
Could you please check.
Thanks.
Aucun commentaire:
Enregistrer un commentaire