Skip to content

Instantly share code, notes, and snippets.

@vrdominguez
Created August 13, 2014 12:11
Show Gist options
  • Save vrdominguez/d3b150f2816182b32817 to your computer and use it in GitHub Desktop.
Save vrdominguez/d3b150f2816182b32817 to your computer and use it in GitHub Desktop.
Versión para OpenWRT del script init.d para poner dinaIP como servicio
#!/bin/sh /etc/rc.common
# dinaIP Service for OpenWRT
# Author: Victor Rodriguez
# Date: 2014-08-13
START=70;
STOP=15;
# Comandos personalizados
EXTRA_COMMANDS="status list"
# Ayuda personalizada
EXTRA_HELP=" status Get daemon status
list Get available domains"
USERNAME="usuario_panel_dinahosting"
PASSWORD="clave_panel_dinahosting"
start() {
# Iniciando dinaIP
/usr/sbin/dinaip -u $USERNAME -p $PASSWORD
}
stop() {
# Deteniendo dinaIP
/usr/sbin/dinaip -d
}
restart() {
/usr/sbin/dinaip -d
/usr/sbin/dinaip -u $USERNAME -p $PASSWORD
}
status() {
/usr/sbin/dinaip -s
# Exit status: 0 - running, 1 - stopped
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
}
list() {
/usr/sbin/dinaip -u $USERNAME -p $PASSWORD -l
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment