Skip to content

Commit fd481c2

Browse files
author
Shlomi Noach
authored
Merge pull request openark#230 from sjmudd/init_script_improvement2
Allow for optional post-processing after starting orchestrator
2 parents c1d9055 + 7945ec6 commit fd481c2

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

etc/init.d/orchestrator.bash

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,24 @@ SCRIPTNAME=/etc/init.d/$NAME
2626
# to increase this limit.
2727
ulimit -n 16384
2828

29+
# initially noop but can adjust according by modifying orchestrator_profile
30+
# - see https://github.com/github/orchestrator/issues/227 for more details.
31+
post_start_daemon_hook () {
32+
# by default do nothing
33+
:
34+
}
35+
36+
# Start the orchestrator daemon in the background
37+
start_daemon () {
38+
# start up daemon in the background
39+
$DAEMON_PATH/$DAEMON $DAEMONOPTS >> /var/log/${NAME}.log 2>&1 &
40+
# collect and print PID of started process
41+
echo $!
42+
# space for optional processing after starting orchestrator
43+
# - redirect stdout to stderro to prevent this corrupting the pid info
44+
post_start_daemon_hook 1>&2
45+
}
46+
2947
# The file /etc/orchestrator_profile can be used to inject pre-service execution
3048
# scripts, such as exporting variables or whatever. It's yours!
3149
[ -f /etc/orchestrator_profile ] && . /etc/orchestrator_profile
@@ -34,7 +52,7 @@ case "$1" in
3452
start)
3553
printf "%-50s" "Starting $NAME..."
3654
cd $DAEMON_PATH
37-
PID=$(./$DAEMON $DAEMONOPTS >> /var/log/${NAME}.log 2>&1 & echo $!)
55+
PID=$(start_daemon)
3856
#echo "Saving PID" $PID " to " $PIDFILE
3957
if [ -z $PID ]; then
4058
printf "%s\n" "Fail"

0 commit comments

Comments
 (0)