summaryrefslogtreecommitdiff
path: root/system/sargon/rc.sargon
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2019-12-01 08:09:33 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2019-12-01 08:09:33 +0700
commit7f8489d5ef1a04f0eff9e58f6d6fd6fb28b59908 (patch)
tree4eb0c85179753ed5b76902d21a5148a65183885a /system/sargon/rc.sargon
parent7f184736aaab928e8cdf8b1e1f17fe169b82df6d (diff)
downloadslackbuilds-7f8489d5ef1a04f0eff9e58f6d6fd6fb28b59908.tar.gz
system/sargon: Added (User privilege system for docker).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/sargon/rc.sargon')
-rw-r--r--system/sargon/rc.sargon50
1 files changed, 50 insertions, 0 deletions
diff --git a/system/sargon/rc.sargon b/system/sargon/rc.sargon
new file mode 100644
index 0000000000..a73ccef363
--- /dev/null
+++ b/system/sargon/rc.sargon
@@ -0,0 +1,50 @@
+#! /bin/sh
+
+CMD=sargon
+OPTIONS=
+
+test -r /etc/default/sargon && . /etc/default/sargon
+
+if [ "$SARGON_TRACE" = "yes" ]; then
+ OPTIONS="$OPTIONS${OPTIONS:+ }-trace"
+fi
+
+if [ "$SARGON_DEBUG" = "yes" ]; then
+ OPTIONS="$OPTIONS${OPTIONS:+ }-debug"
+fi
+
+sargon_start() {
+ if [ -n "$(/sbin/pidof $CMD)" ]; then
+ echo >&2 "$0: $CMD is already running"
+ else
+ /usr/bin/$CMD $OPTIONS | /usr/bin/logger -t $CMD -p daemon.info &
+ fi
+}
+
+sargon_stop() {
+ /usr/bin/pkill $CMD
+}
+
+sargon_status() {
+ pid=$(/sbin/pidof $CMD)
+ if [ -n "$pid" ]; then
+ echo "$CMD is running (pid $pid)"
+ else
+ echo "$CMD is not running"
+ fi
+}
+
+case $1 in
+ start)
+ sargon_start
+ ;;
+ stop)
+ sargon_stop
+ ;;
+ restart)
+ sargon_stop
+ sargon_start
+ ;;
+ status)
+ sargon_status
+esac