2022-03-28 23:53:26 +00:00
|
|
|
#!/bin/bash
|
2022-02-05 14:23:32 +00:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
# Copyright (C) 2021-present Fewtarius (https://github.com/fewtarius)
|
|
|
|
|
|
|
|
. /etc/profile
|
|
|
|
|
|
|
|
for service in /usr/lib/autostart/daemons
|
|
|
|
do
|
|
|
|
if [ ! -d "/storage/.cache/services" ]
|
|
|
|
then
|
|
|
|
mkdir -p "/storage/.cache/services"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -e "/storage/.cache/services/${CONF}" ]
|
|
|
|
then
|
|
|
|
rm -f "/storage/.cache/services/${CONF}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
statemgr() {
|
|
|
|
for daemon in ${DAEMONS[@]}
|
|
|
|
do
|
2022-03-27 19:40:10 +00:00
|
|
|
nohup systemctl ${1} ${daemon} &
|
2022-02-05 14:23:32 +00:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$STATE" in
|
|
|
|
"1")
|
|
|
|
touch "/storage/.cache/services/${CONF}"
|
|
|
|
statemgr start
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
statemgr stop
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|