Commit fe0a322f authored by Ask Solem's avatar Ask Solem Committed by Brian May
parent 8af58d64
......@@ -33,9 +33,14 @@ if [ $(id -u) -ne 0 ]; then
exit 1
fi
origin_is_runlevel_dir () {
set +e
dirname $0 | grep -q "/etc/rc.\.d"
echo $?
}
# May be a runlevel symlink (e.g. S02celeryd)
if [ -L "$0" ]; then
# Can be a runlevel symlink (e.g. S02celeryd)
if [ $(origin_is_runlevel_dir) -eq 0 ]; then
SCRIPT_FILE=$(readlink "$0")
else
SCRIPT_FILE="$0"
......
......@@ -41,9 +41,14 @@ if [ $(id -u) -ne 0 ]; then
exit 1
fi
origin_is_runlevel_dir () {
set +e
dirname $0 | grep -q "/etc/rc.\.d"
echo $?
}
# Can be a runlevel symlink (e.g. S02celeryd)
if [[ `dirname $0` == /etc/rc*.d ]]; then
if [ $(origin_is_runlevel_dir) -eq 0 ]; then
SCRIPT_FILE=$(readlink "$0")
else
SCRIPT_FILE="$0"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment