summaryrefslogtreecommitdiff
path: root/user/apaste/apasted.initd
diff options
context:
space:
mode:
Diffstat (limited to 'user/apaste/apasted.initd')
-rw-r--r--user/apaste/apasted.initd64
1 files changed, 64 insertions, 0 deletions
diff --git a/user/apaste/apasted.initd b/user/apaste/apasted.initd
new file mode 100644
index 000000000..f730f8012
--- /dev/null
+++ b/user/apaste/apasted.initd
@@ -0,0 +1,64 @@
+#!/sbin/openrc-run
+
+description="Start/stop the apasted services"
+
+depend()
+{
+ after net
+ after localmount
+}
+
+_get_services()
+{
+ list=
+ if test -n "$APASTED_PORT" ; then
+ if test -n "$APASTED_IPv4" ; then
+ list="apasted-4"
+ fi
+ if test -n "$APASTED_IPv6" ; then
+ list="$list apasted-6"
+ fi
+ fi
+ if test -n "$APASTED_TLS_PORT" ; then
+ if test -n "$APASTED_IPV4" ; then
+ list="apastesd-4"
+ fi
+ if test -n "$APASTED_IPV6" ; then
+ list="$list apastesd-6"
+ fi
+ fi
+ echo $list
+}
+
+stop()
+{
+ ebegin "Stopping the apasted services"
+ for i in `_get_services` ; do
+ s6-svunlink /run/service "$i"
+ done
+ eend $?
+}
+
+start()
+{
+ ebegin "Starting the apasted services"
+ for i in `_get_services` ; do
+ s6-svlink -t10000 /run/service "/var/lib/apasted/services/$i"
+ done
+ eend $?
+}
+
+status()
+{
+ for i in `_get_services` ; do
+ echo -n "${i}: "
+ s6-svstat "/run/service/${i}"
+ done
+}
+
+restart()
+{
+ for i in `_get_services` ; do
+ s6-svc -rwR "/run/service/$i"
+ done
+}