aboutsummaryrefslogtreecommitdiff
path: root/system/local-persist/rc.local-persist
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2019-10-05 06:41:14 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2019-10-05 06:41:14 +0700
commit4ee42f50aa960d276e37acf49f54f438e5e78220 (patch)
tree6c9df54c0ba1d9c91f4b50c167fc9a3fdb1bf7cd /system/local-persist/rc.local-persist
parent9806cc87f246985e3547d4e4cb90e8898d7c3083 (diff)
system/local-persist: Added (Create persistent local volumes).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/local-persist/rc.local-persist')
-rw-r--r--system/local-persist/rc.local-persist39
1 files changed, 39 insertions, 0 deletions
diff --git a/system/local-persist/rc.local-persist b/system/local-persist/rc.local-persist
new file mode 100644
index 000000000000..30fa1d07cf48
--- /dev/null
+++ b/system/local-persist/rc.local-persist
@@ -0,0 +1,39 @@
+#! /bin/sh
+
+CMD=local-persist
+
+local_persist_start() {
+ if [ -n "$(/sbin/pidof $CMD)" ]; then
+ echo >&2 "$0: $CMD is already running"
+ else
+ /usr/bin/$CMD | /usr/bin/logger -t $CMD -p daemon.info &
+ fi
+}
+
+local_persist_stop() {
+ /usr/bin/pkill $CMD
+}
+
+local_persist_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)
+ local_persist_start
+ ;;
+ stop)
+ local_persist_stop
+ ;;
+ restart)
+ local_persist_stop
+ local_persist_start
+ ;;
+ status)
+ local_persist_status
+esac