#!/usr/bin/bash # # Author: Dmitry Razumov # Copyright (c) 2021-2025 UBLinux # # SPDX-License-Identifier: AGPL-3.0-or-later # ENABLED=yes [[ ${ENABLED} == "yes" ]] || { return 0 2>/dev/null && return 0 || exit 0; } #HALT_PROCESSES_KILL="slim kdm X lxdm xdm sddm cupsd pdnsd mc mandb" HALT_PROCESSES_KILL="" HALT_SERVICES_STOP="" HALT_EXCLUDE_STOP="" PATH=/usr/lib/ublinux/scripts:$PATH . /usr/lib/ublinux/default SOURCE=${SYSCONF}/config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null SOURCE=${SYSCONF}/system; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null SOURCE=${SYSCONF}/desktop; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null # Stop DisplayManager #HALT_SERVICES_STOP="$HALT_SERVICES_STOP $(echo $SERVICES_ENABLE | tr "," " ") display-manager.service" #HALT_SERVICES_STOP="$HALT_SERVICES_STOP $(systemctl list-units --type=service --state=running | grep -E "$DISPLAYMANAGER.*running" | awk '{$1=$1;print}' | cut -d ' ' -f 1 | xargs)" # Stop all running service #HALT_SERVICES_STOP="$HALT_SERVICES_STOP $(systemctl list-units --type=service --state=running | grep -E "running" | awk '{$1=$1;print}' | cut -d ' ' -f 1 | egrep -v " ${HALT_EXCLUDE_STOP}" | xargs)" for SERVICE in ${HALT_SERVICES_STOP}; do [[ -z "${SERVICE}" ]] || systemctl stop ${SERVICE} 2>/dev/null done # Kill all users apps #GROUPFORLIST="users" #LISTUSERS=$(cut -d: -f1,4 /etc/passwd | grep $(getent group $GROUPFORLIST | cut -d: -f3) | cut -d: -f1 | xargs |tr " " ",") #LISTUSERSOTHER=$(getent group $GROUPFORLIST | cut -d: -f4) #[ -z $LISTUSERSOTHER ] || LISTUSERS="$LISTUSERS,$LISTUSERSOTHER" #pkill -U $LISTUSERS [[ -z ${HALT_PROCESSES_KILL} ]] || killall -9 ${HALT_PROCESSES_KILL}