Skip to content

Commit

Permalink
[init.d] Respect symlink to /etc/rc*.d
Browse files Browse the repository at this point in the history
  • Loading branch information
ask committed May 23, 2016
1 parent df96a27 commit 5447aa9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions extra/generic-init.d/celerybeat
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,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"
Expand Down

0 comments on commit 5447aa9

Please sign in to comment.