Update orbit service.
This commit is contained in:
parent
2235968164
commit
4ca406b89f
|
@ -49,16 +49,44 @@ start_orbit () {
|
|||
echo "Starting $ORBIT_ROOT";
|
||||
sudo su -l $ORBIT_USER -c "cd $ORBIT_ROOT && bundle exec unicorn_rails -D -E $RAILS_ENV -c config/unicorn.rb";
|
||||
}
|
||||
|
||||
bundle_orbit () {
|
||||
args="$1"
|
||||
if [[ -z $args ]]; then
|
||||
args="install"
|
||||
fi
|
||||
sudo su -l $ORBIT_USER -c "cd $ORBIT_ROOT && bundle $args";
|
||||
}
|
||||
case $1 in
|
||||
install)
|
||||
if [ ! -z "$2" ]; then
|
||||
get_orbit_root $2
|
||||
bundle_orbit
|
||||
else
|
||||
closed_sites="$(cat /home/$ORBIT_USER/closed_sites.txt)"
|
||||
for APP in `ls -1 $NGINX_ORBIT_SITES`; do
|
||||
get_orbit_root $APP;
|
||||
if [[ ! "$closed_sites" =~ "$ORBIT_ROOT" ]]; then
|
||||
bundle_orbit;
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
exit 0;
|
||||
;;
|
||||
start)
|
||||
if [ ! -z "$2" ]; then
|
||||
get_orbit_root $2
|
||||
start_orbit
|
||||
else
|
||||
closed_sites="$(cat /home/$ORBIT_USER/closed_sites.txt)"
|
||||
for APP in `ls -1 $NGINX_ORBIT_SITES`; do
|
||||
get_orbit_root $APP;
|
||||
if [[ "$closed_sites" =~ "$ORBIT_ROOT" ]]; then
|
||||
echo "Stopping $ORBIT_ROOT";
|
||||
sig QUIT && continue;
|
||||
else
|
||||
start_orbit;
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
|
@ -123,11 +151,17 @@ restart|reload)
|
|||
echo >&2 "Couldn't reload $ORBIT_ROOT, starting instead"
|
||||
start_orbit
|
||||
else
|
||||
closed_sites="$(cat /home/$ORBIT_USER/closed_sites.txt)"
|
||||
for APP in `ls -1 $NGINX_ORBIT_SITES`; do
|
||||
get_orbit_root $APP;
|
||||
if [[ "$closed_sites" =~ "$ORBIT_ROOT" ]]; then
|
||||
echo "Stopping $ORBIT_ROOT";
|
||||
sig QUIT && continue;
|
||||
else
|
||||
sig USR2 && echo "$ORBIT_ROOT reloaded OK" && continue;
|
||||
echo >&2 "Couldn't reload $ORBIT_ROOT, starting instead";
|
||||
start_orbit;
|
||||
fi
|
||||
done
|
||||
fi
|
||||
exit 0;
|
||||
|
|
Loading…
Reference in New Issue