Skip to content

Instantly share code, notes, and snippets.

@vrdominguez
Last active March 26, 2017 09:39
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vrdominguez/10284009 to your computer and use it in GitHub Desktop.
Save vrdominguez/10284009 to your computer and use it in GitHub Desktop.
Script para gestionar el demonio de dinaIp como un servicio más del sistema. Más info: http://vrdominguez.es/sustituir-dyndns-con-una-raspberry-y-dinaip/
#!/bin/bash
# Author: Victor Rodriguez, 2014
#
# /etc/init.d/dinaip
#
### BEGIN INIT INFO
# Provides: dinaIP daemon
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Script para iniciar dinaIP
# Description: Este script lanza el demonio de dinaIP
#
### END INIT INFO
# Descripcion
DESC="dinaIP daemon"
# Configuraciones
USERNAME="usuario_panel_dinahosting"
PASSWORD="clave_panel_dinahosting"
# Control del demonio
case "$1" in
start)
# Start the daemon
/usr/sbin/dinaip -u $USERNAME -p $PASSWORD
;;
stop)
# Stop the daemon
/usr/sbin/dinaip -d
;;
restart)
/usr/sbin/dinaip -d
/usr/sbin/dinaip -u $USERNAME -p $PASSWORD
;;
status)
/usr/sbin/dinaip -s
if [ -f /var/run/dinaip.pid ]; then
kill -0 `cat /var/run/dinaip.pid`
if [ "$?" == "0" ]; then
exit 0
else
exit 1
fi
else
exit 1
fi
;;
*)
# Rechazar operaciones no aceptadaas
echo "Usage: service dinaip {start|stop|restart|status}"
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment