mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Add the ability to pass environment variables to the init script (for Jungle).
Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
This commit is contained in:
parent
bdb3478fb6
commit
266540cec3
1 changed files with 19 additions and 4 deletions
|
@ -47,7 +47,8 @@ do_start() {
|
|||
if [ "$log_file" = "" ]; then
|
||||
log_file="$dir/log/puma.log"
|
||||
fi
|
||||
do_start_one $dir $user $config_file $log_file
|
||||
environment=`echo $i | cut -d , -f 5`
|
||||
do_start_one $dir $user $config_file $log_file $environment
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -57,12 +58,12 @@ do_start_one() {
|
|||
PID=`cat $PIDFILE`
|
||||
# If the puma isn't running, run it, otherwise restart it.
|
||||
if [ "`ps -A -o pid= | grep -c $PID`" -eq 0 ]; then
|
||||
do_start_one_do $1 $2 $3 $4
|
||||
do_start_one_do $1 $2 $3 $4 $5
|
||||
else
|
||||
do_restart_one $1
|
||||
fi
|
||||
else
|
||||
do_start_one_do $1 $2 $3 $4
|
||||
do_start_one_do $1 $2 $3 $4 $5
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -70,6 +71,14 @@ do_start_one_do() {
|
|||
log_daemon_msg "--> Woke up puma $1"
|
||||
log_daemon_msg "user $2"
|
||||
log_daemon_msg "log to $4"
|
||||
|
||||
if [ ! -z "$5" ]; then
|
||||
for e in $(echo "$5" | tr ';' '\n'); do
|
||||
log_daemon_msg "environment $e"
|
||||
v=${e%%\=*} ; eval "$e" ; export $v
|
||||
done
|
||||
fi
|
||||
|
||||
start-stop-daemon --verbose --start --chdir $1 --chuid $2 --background --exec $RUNPUMA -- $1 $3 $4
|
||||
}
|
||||
|
||||
|
@ -140,7 +149,8 @@ do_restart_one() {
|
|||
if [ "$log_file" = "" ]; then
|
||||
log_file="$dir/log/puma.log"
|
||||
fi
|
||||
do_start_one $dir $user $config_file $log_file
|
||||
environment=`echo $i | cut -d , -f 5`
|
||||
do_start_one $dir $user $config_file $log_file $environment
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
@ -209,6 +219,11 @@ do_add() {
|
|||
str="$str,$4"
|
||||
fi
|
||||
|
||||
# Environment variables
|
||||
if [ "$5" != "" ]; then
|
||||
str="$str,$5"
|
||||
fi
|
||||
|
||||
# Add it to the jungle
|
||||
echo $str >> $CONFIG
|
||||
log_daemon_msg "Added a Puma to the jungle: $str. You still have to start it though."
|
||||
|
|
Loading…
Add table
Reference in a new issue