Skip to content

Instantly share code, notes, and snippets.

@wiltonbsilva
Created November 6, 2014 15:08
Show Gist options
  • Save wiltonbsilva/03b113e52151de64c5c6 to your computer and use it in GitHub Desktop.
Save wiltonbsilva/03b113e52151de64c5c6 to your computer and use it in GitHub Desktop.
## verifies if a service is running. If not, starts the service.
service_search_string=Tardis
function start(){
# code to start your service =)
}
function check(){
ps -ef | grep $service_search_string | grep -v grep
if [ $? -eq "0" ]; then
echo "process is running"
else
start
fi
}
check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment