Tuesday, 20 August 2013

run command in bash and then exit without killing the command

run command in bash and then exit without killing the command

I am attempting to run a couple commands in a bash script however it will
hang up on my command waiting for it to complete (which it wont). this
script is simply making sure its running.
#!/bin/bash
ps cax | grep python > /dev/null
if [ $? -eq 0 ]; then
echo "Process is running."
else
echo "Process is not running... Starting..."
python likebot.py
echo $(ps aux | grep python | grep -v color | awk {'print $2'})
fi
Once it gets to the python command it hangs up while the command is being
executed. its not till i cntrl c before it gives the pid. is there anyway
i can have it run this bash script and exit the bash script once the
commands were run (without waiting for them to complete).

No comments:

Post a Comment