Mercurial > vanilla
view system/acpid/acpid @ 1277:cbb174b1c555
core/ca-certificates: upgrade to 20211026
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 11 Nov 2021 07:36:45 +0100 |
parents | 3dfef64b81c1 |
children |
line wrap: on
line source
#!/bin/sh # # /etc/rc.d/acpid -- run control script for acpid # # Copyright (c) 2019 David Demelier <markand@malikania.fr> # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # if [ -f /etc/rc.conf ]; then . /etc/rc.conf fi : ${ACPID_CMD:=/bin/acpid} : ${ACPID_ARGS:=} : ${ACPID_PID:=/var/run/acpid.pid} acpid_start() { if [ -s $ACPID_PID ]; then echo "acpid is already running with pid: $(cat $ACPID_PID)" else echo "Starting acpid: $ACPID_CMD $ACPID_ARGS" $ACPID_CMD $ACPID_ARGS -p $ACPID_PID fi } acpid_status() { if [ -s $ACPID_PID ]; then echo "acpid is running with pid: $(cat $ACPID_PID)" else echo "acpid is not running" fi } acpid_stop() { if [ -s $ACPID_PID ]; then echo "Stopping acpid." kill -QUIT $(cat $ACPID_PID) fi } acpid_restart() { acpid_stop sleep 3 acpid_start } case $1 in start) acpid_start ;; status) acpid_status ;; stop) acpid_stop ;; restart) acpid_restart ;; *) echo "usage: $(basename $0) restart|start|status|stop" ;; esac