mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-24 11:46:30 +00:00
Add /sbin/service helper script
This commit is contained in:
parent
a686131ce1
commit
6340380d0d
24
board/common/overlay/sbin/service
Executable file
24
board/common/overlay/sbin/service
Executable file
@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
function show_usage() {
|
||||
echo "Usage: service <service_name> [command]"
|
||||
echo "Usual commands include: start, stop, restart"
|
||||
echo "Type 'service <service_name>' without command for service-specific usage"
|
||||
}
|
||||
|
||||
if [[ -z "$1" ]]; then
|
||||
show_usage 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SERVICE=$1
|
||||
|
||||
shift # Remove $1
|
||||
SCRIPT=(/etc/init.d/S*${SERVICE})
|
||||
|
||||
if ! [[ -x "${SCRIPT}" ]]; then
|
||||
echo "No such service: ${SERVICE}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source ${SCRIPT} "$@"
|
Loading…
x
Reference in New Issue
Block a user