some cleanup
Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
parent
758e841e1e
commit
4dee8a29b6
69
ssm
69
ssm
|
@ -379,7 +379,7 @@ info() {
|
||||||
printf "%12s: %s\n" "${_info_items[@]}"
|
printf "%12s: %s\n" "${_info_items[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Restart just calls the script twice by default
|
## Restart just calls the script twice by default
|
||||||
restart() {
|
restart() {
|
||||||
"$_self" "$service_name" stop
|
"$_self" "$service_name" stop
|
||||||
"$_self" "$service_name" start
|
"$_self" "$service_name" start
|
||||||
|
@ -390,9 +390,9 @@ logs() { $PAGER "$service_logfile"; }
|
||||||
|
|
||||||
## Status is a bit of a special case. It's talkative.
|
## Status is a bit of a special case. It's talkative.
|
||||||
status() {
|
status() {
|
||||||
(( service_running )) && return 0
|
service_running && return 0
|
||||||
(( service_enabled )) && return 0
|
service_enabled && return 0
|
||||||
(( service_stopped )) && return 7
|
service_stopped && return 7
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
@ -404,38 +404,35 @@ qstatus() { nullexec status; }
|
||||||
ready() { :; }
|
ready() { :; }
|
||||||
|
|
||||||
# Main code
|
# Main code
|
||||||
# Figure out our full path
|
## Empty declarations
|
||||||
case "$0" in
|
var service_pid \
|
||||||
(/*) var _self = "$0";;
|
service_pidfile \
|
||||||
(*) var _self = "$PWD/$0";;
|
service_type \
|
||||||
esac
|
service_depends_ready \
|
||||||
|
service_command \
|
||||||
|
service_config \
|
||||||
|
service_path \
|
||||||
|
service_name \
|
||||||
|
service_args \
|
||||||
|
service_logfile \
|
||||||
|
service_ready_flag \
|
||||||
|
service_enabled_flag \
|
||||||
|
service_stopped_flag \
|
||||||
|
failed_deps \
|
||||||
|
svc_pidfile \
|
||||||
|
cfg_path \
|
||||||
|
cfg_dir \
|
||||||
|
rundir \
|
||||||
|
logdir \
|
||||||
|
_self
|
||||||
|
|
||||||
# check for some environment stuff
|
## check for some environment stuff
|
||||||
var EDITOR := 'vim'
|
var EDITOR := 'vim'
|
||||||
var PAGER := 'less'
|
var PAGER := 'less'
|
||||||
|
var XDG_CONFIG_HOME := "$HOME/.config"
|
||||||
|
var XDG_RUNTIME_DIR := "/run/user/$UID"
|
||||||
|
|
||||||
# Empty declarations
|
## Let's set some defaults
|
||||||
var service_pid
|
|
||||||
var service_pidfile
|
|
||||||
var service_type
|
|
||||||
var service_depends_ready
|
|
||||||
var service_command
|
|
||||||
var service_config
|
|
||||||
var service_path
|
|
||||||
var service_name
|
|
||||||
var service_args
|
|
||||||
var service_logfile
|
|
||||||
var service_ready_flag
|
|
||||||
var service_enabled_flag
|
|
||||||
var service_stopped_flag
|
|
||||||
var failed_deps
|
|
||||||
var svc_pidfile
|
|
||||||
var cfg_path
|
|
||||||
var cfg_dir
|
|
||||||
var rundir
|
|
||||||
var logdir
|
|
||||||
|
|
||||||
# Let's set some defaults
|
|
||||||
var service_managed = 0
|
var service_managed = 0
|
||||||
var service_respawn = 0
|
var service_respawn = 0
|
||||||
var service_oneshot = 0
|
var service_oneshot = 0
|
||||||
|
@ -454,9 +451,11 @@ var systemd_service_path = /etc/systemd/system /run/systemd/system /lib/systemd/
|
||||||
var ssm_config = 0
|
var ssm_config = 0
|
||||||
var usrdir = '/usr/share/ssm'
|
var usrdir = '/usr/share/ssm'
|
||||||
|
|
||||||
# XDG stuff
|
## Figure out our full path
|
||||||
var XDG_CONFIG_HOME := "$HOME/.config"
|
case "$0" in
|
||||||
var XDG_RUNTIME_DIR := "/run/user/$UID"
|
(/*) _self = "$0";;
|
||||||
|
(*) _self = "$PWD/$0";;
|
||||||
|
esac
|
||||||
|
|
||||||
if (( $UID )); then
|
if (( $UID )); then
|
||||||
rundir = "$XDG_RUNTIME_DIR/ssm"
|
rundir = "$XDG_RUNTIME_DIR/ssm"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user