petite demo avec le service apache2
vi service_down_to_up.sh
copie colle ...
#!/bin/bash
# Service Process Monitor
# Restart a Service When It Goes Down
# ----------------------------------------------------------
# Copyright (c) 2011 David H.
# ----------------------------------------------------------
SERVICE_NAME="apache2"
RESTART="service $SERVICE_NAME restart"
# path to pgrep command
PGREP=$(which pgrep)
# find service pid
$PGREP ${SERVICE_NAME}
[ $? -ne 0 ] && $RESTART || : # if service not running
sudo chmod +x service_down_to_up.sh
./service_down_to_up.sh
Aucun commentaire:
Enregistrer un commentaire