Script linuxrc.sh
Jump to navigation
Jump to search
#!/bin/sh # # NAME /srv/config/linuxrc.sh # VERSION 1.1 # REQUIRED # echo echo echo echo "Daemons control script:" echo PATH=/sbin:/bin:/usr/sbin:/usr/bin; RUNPATH=$1; ACTION=$2; DAEMONS_PATH="${RUNPATH}"/rc.d; if ! test -d "${RUNPATH}"; then echo "Usage: $0 <run_path> {start|stop}"; exit 1; fi; if ! test -d "${DAEMONS_PATH}"; then echo "Can't find ${DAEMONS_PATH}"; exit 1; fi; RET_CODE=0; case "${ACTION}" in start) for SCRIPT in "${DAEMONS_PATH}"/S* ; do test -x "${SCRIPT}" && "${SCRIPT}" start; done; ;; stop) for SCRIPT in "${DAEMONS_PATH}"/K* ; do test -x "${SCRIPT}" && "${SCRIPT}" stop; done; ;; status|restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2; RET_CODE=1; ;; *) echo "Usage: $0 <run_path> {start|stop}"; RET_CODE=1; ;; esac; exit "${RET_CODE}"; # End