2015-11-02 12:54:15 +01:00
|
|
|
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
|
|
|
|
usage() {
|
|
|
|
echo "Usage: $0 [--root=path] enable|disable|is-enabled <sysv script name>" >&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
eval set -- "$(getopt -o r: --long root: -- "$@")"
|
|
|
|
while true; do
|
|
|
|
case "$1" in
|
|
|
|
-r|--root)
|
|
|
|
ROOT="$2"
|
|
|
|
shift 2 ;;
|
|
|
|
--) shift ; break ;;
|
|
|
|
*) usage ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
NAME="$2"
|
|
|
|
ROOT="${ROOT:+--root=$ROOT}"
|
|
|
|
[ -n "$NAME" ] || usage
|
|
|
|
case "$1" in
|
|
|
|
enable) chkconfig $ROOT -a "$NAME" ;;
|
2016-02-03 10:19:12 +01:00
|
|
|
disable) chkconfig $ROOT -d "$NAME" ;;
|
2015-11-02 12:54:15 +01:00
|
|
|
is-enabled) chkconfig $ROOT -t "$NAME" ;;
|
|
|
|
*) usage ;;
|
|
|
|
esac
|