about summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/sv24
-rwxr-xr-xbin/svtree-run4
2 files changed, 13 insertions, 15 deletions
diff --git a/bin/sv b/bin/sv
index 2f2bcf2..868125f 100755
--- a/bin/sv
+++ b/bin/sv
@@ -3,10 +3,9 @@ set -eu
 [ -n "${DEBUG:-}" ] && set -x
 
 SYS_RT=/run
-USER_RT=$XDG_RUNTIME_DIR
+USER_RT=${XDG_RUNTIME_DIR:-/nouser} # fallback when not set
 
-main()
-{
+main() {
 	# NOTE: this assumes that:
 	#   system services have their live dir at /run/s6-rc
 	#     user services have their live dir at $XDG_RUNTIME_DIR/s6-rc
@@ -30,7 +29,7 @@ main()
 	##
 	## db
 	##
-	reload|recompile)
+	reload | recompile)
 		export LIVEDIR="$l"
 		export STATEDIR="$confdir"
 		export SRCDIR="$confdir/src"
@@ -40,25 +39,24 @@ main()
 	##
 	## service
 	##
-	up|start)
+	up | start)
 		exec s6-rc -v2 -l "$l" -b start $@
 		;;
 
-	dn|down|stop)
+	dn | down | stop)
 		exec s6-rc -v2 -l "$l" -b stop $@
 		;;
 
-	re|restart)
+	re | restart)
 		$0 dn $@ && $0 up $@
 		;;
 
-	st|status|info) 
+	st | status | info)
 		local sv=${1:?}
 		s6-rc-db -l "$l" type $sv >/dev/null 2>&1 || exit 1
 
 		printf 'Service (%s):\n' $(s6-rc-db -l "$l" type $sv)
-		for ln in $(s6-rc-db -l "$l" atomics $sv)
-		do
+		for ln in $(s6-rc-db -l "$l" atomics $sv); do
 			printf '%s: ' $ln
 			s6-svstat "$l/servicedirs/$ln"
 		done | sort -k 2 | column -s ':' -t
@@ -73,8 +71,8 @@ main()
 			tail -n 10 "$logfile"
 		fi
 		;;
-	
-	logtail|logs)
+
+	logtail | logs)
 		local sv=${1:?}
 		# NOTE: this assumes logs are stored in $rt/log
 		logfile="$rt/log/$sv/current"
@@ -106,7 +104,7 @@ main()
 	##
 	## listall
 	##
-	ls|list|ps|*)
+	ls | list | ps | *)
 		[ "${1:-}" = "-a" ] && exec s6-rc-db -l "$l" list services
 		exec s6-rc -v2 -l "$l" -a list
 		;;
diff --git a/bin/svtree-run b/bin/svtree-run
index eab97f5..9424f39 100755
--- a/bin/svtree-run
+++ b/bin/svtree-run
@@ -1,7 +1,7 @@
 #!/bin/execlineb -P
 
-importas -iS -D "/etc" XDG_CONFIG_HOME
-importas -iS -D "/run" XDG_RUNTIME_DIR
+importas -D "/etc" -S XDG_CONFIG_HOME
+importas -D "/run" -S XDG_RUNTIME_DIR
 
 envfile -I /opt/svtree/dirs.conf