summaryrefslogtreecommitdiff
path: root/social/tinc/tincd.rcd
diff options
context:
space:
mode:
authorNicolás Reynolds <apoyosis@correo.inta.gob.ar>2011-06-26 17:41:46 -0300
committerNicolás Reynolds <apoyosis@correo.inta.gob.ar>2011-06-26 17:41:46 -0300
commit4f72d84c329d227609bcc426ca3651136bfa7ae8 (patch)
treeb0f2c85fdef442097d64b42ac8066a600182cadb /social/tinc/tincd.rcd
parent98323a21eb3d0e681aea360e483fb52dfcd9bb82 (diff)
social/tinc-1.0.15-2
Includes daemon script
Diffstat (limited to 'social/tinc/tincd.rcd')
-rw-r--r--social/tinc/tincd.rcd43
1 files changed, 43 insertions, 0 deletions
diff --git a/social/tinc/tincd.rcd b/social/tinc/tincd.rcd
new file mode 100644
index 000000000..f0a456e17
--- /dev/null
+++ b/social/tinc/tincd.rcd
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+daemon_name=tincd
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/$daemon_name.conf
+
+PID=`pidof -o %PPID /usr/sbin/tincd`
+
+case "$1" in
+ start)
+ stat_busy "Starting ${daemon_name}"
+ [ -z "$PID" ] && \
+ /usr/sbin/tincd -n ${NETNAME} \
+ --pidfile=/var/run/tinc.${NETNAME} &> /dev/null
+
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon ${daemon_name}
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping ${daemon_name}"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon ${daemon_name}
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0