Affichage des articles dont le libellé est démarrage. Afficher tous les articles
Affichage des articles dont le libellé est démarrage. Afficher tous les articles

vendredi 12 juin 2009

Script de démarrage automatique du serveur GALLS

Et hop, un petit coup de update-rc.d plus loin, et GALLS démarre tout seul désormais !
#! /bin/sh

### BEGIN INIT INFO
# Provides: galsvlux
# Default-Start: 2 3 4 5
# Default-Stop: 1
# Short-Description: GALSS Server
### END INIT INFO

set -e

# /etc/init.d/galsvlux: start and stop the OpenBSD "secure shell(tm)" daemon

. /lib/lsb/init-functions

case "$1" in
start)
export pid=`pidof galsvlux`;
if [ "$pid" = "" ];
then
log_daemon_msg "Starting GALSS server";
/usr/local/bin/galsvlux -t3 -i1 -r;
export pid=`pidof galsvlux`;
if [ "$pid" = "" ];
then
log_action_msg "WARN : GALSS Server NOT running !";
log_end_msg 1;
else
log_action_msg "GALSS Server running (pid $pid)";
log_end_msg 0;
fi
else
log_action_msg "GALSS Server yet running (pid $pid)";
log_end_msg 0;
fi

;;
stop)
log_daemon_msg "Stopping GALSS server";
/usr/local/bin/galsvlux -t3 -k;
export pid=`pidof galsvlux`;
if [ "$pid" = "" ];
then
log_action_msg "GALSS Server successfully stopped";
log_end_msg 0;
else
log_daemon_msg "GALSS Server still running ... Killing GALSS server (pid $pid)";
kill -9 $pid;
export pid=`pidof galsvlux`;
if [ "$pid" = "" ];
then
log_action_msg "GALSS Server successfully stopped";
log_end_msg 0;
else
log_action_msg "WARN : GALSS still running ! (pîd $pid)";
log_end_msg 1;
fi
fi
;;

status)
export pid=`pidof galsvlux`;
if [ "$pid" = "" ];
then
log_action_msg "GALSS Server stopped";
else
log_action_msg "GALSS Server running (pid $pid)";
fi
;;

*)
log_action_msg "Usage: /etc/init.d/galsvlux {start|stop|status}"
exit 1;
esac

exit 0