Showing posts with label Shell Script. Show all posts
Showing posts with label Shell Script. Show all posts

Friday, November 23, 2018

Simple shell script to check whether a process is running or not, if not it will start it

I need a simple shell script to check whether a process is running or not, if not it will start it.

Here in this example, i am checking my node process.

if ! pgrep -x "node" > /dev/null
then
   nohup start.js &

fi