Script básico para init.d

24 02 2011

El siguiente script contiene lo esencial para poder iniciar, parar y reiniciar desde el init:

#!/bin/sh
# Script para arrancar, parar y reiniciar un servicio
#
case "$1" in
start)
start-stop-daemon --start --exec /ruta/al/ejecutable
echo "Iniciando..."
;;
stop)
start-stop-daemon --stop --exec /ruta/al/ejecutable
echo "Parando..."
;;
restart)
$0 stop
$0 start
;;
status)
if pidof -o %PPID rpc.mountd > /dev/null; then
echo "Iniciado"
exit 0
else
echo "Parado"
exit 1
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac

Advertisements

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: