Skip to content

Commit

Permalink
Ignore services in machine.slice by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Antiz96 committed Jul 15, 2024
1 parent f9018d0 commit bad64af
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions admin/checkservices
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ RESTART=1 # restart services
SERIALIZE=0 # run in parallel
STATUS=1 # display status after systemctl
USER_SLICE=0 # act on users services
MACHINE_SLICE=0 # act on machine services

# print $* as an arrow line
arrow() {
Expand Down Expand Up @@ -126,6 +127,7 @@ get_broken_maps() {
[[ -z "$pidfile" ]] && error "Unable to find pid file for $service." && continue
# skip non system units
(( $USER_SLICE == 0 )) && [[ "$unit_path" =~ /user\.slice/ ]] && continue
(( $MACHINE_SLICE == 0 )) && [[ "$unit_path" =~ /machine\.slice/ ]] && continue
# parse pidfile
pids=( $(< "$pidfile") )
if (( "${#pids[*]}" == 0 )); then
Expand Down Expand Up @@ -251,6 +253,7 @@ usage() {
echo " -r/-R: restart (or not) services with updated files (default: $RESTART)" >&2
echo " -s/-S: display (or not) status of restarted service (default: $STATUS)" >&2
echo " -u/-U: act (or not) on services in users slice (default: $USER_SLICE)" >&2
echo " -m/-M: act (or not) on services in machine slice (default: $MACHINE_SLICE)" >&2
echo " -z/-Z: serialize (or not) action (default: $SERIALIZE)" >&2
exit 2
}
Expand All @@ -268,6 +271,7 @@ argparse() {
R) RESTART=0;; r) RESTART=1;;
S) STATUS=0;; s) STATUS=1;;
U) USER_SLICE=0;; u) USER_SLICE=1;;
M) MACHINE_SLICE=0;; m) MACHINE_SLICE=1;;
Z) SERIALIZE=0;; z) SERIALIZE=1;;
*) usage;;
esac
Expand Down

0 comments on commit bad64af

Please sign in to comment.