Skip to content

Instantly share code, notes, and snippets.

@rmsaitam
Created September 19, 2019 12:55
Show Gist options
  • Save rmsaitam/69c9be253d1c2f1abb0dbcc01fc5ec11 to your computer and use it in GitHub Desktop.
Save rmsaitam/69c9be253d1c2f1abb0dbcc01fc5ec11 to your computer and use it in GitHub Desktop.
Verifica se o serviço está parado e inicializa o serviço novamente
#!/bin/bash
#lista a quantidade de registros
#substituir <service-name>
QUANTIDADE="`ls | ps -e -o comm | grep <service-name> | wc -l`"
#se $QUANTIDADE for menor que 1:
if [ $QUANTIDADE -lt 1 ];
then
#ativa o serviço
service <service-name> start
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment