Fix bug.
This commit is contained in:
parent
5e95523820
commit
76ca8ced90
|
@ -136,7 +136,7 @@ if [[ ! -f /etc/init.d/nginx ]]; then
|
|||
sudo wget http://gitlab.tp.rulingcom.com/erictyl/install_r45_on_ubuntu_1804lts_doc/-/raw/master/nginx.service -O /lib/systemd/system/nginx.service
|
||||
sudo chown root:root /lib/systemd/system/nginx.service
|
||||
sudo chmod 644 /lib/systemd/system/nginx.service
|
||||
sudo chmod +x /lib/systemd/system/nginx.service
|
||||
sudo chmod -x /lib/systemd/system/nginx.service
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl unmask nginx
|
||||
sudo systemctl enable nginx
|
||||
|
|
|
@ -18,9 +18,7 @@ if [[ ! -e "/usr/lib/x86_64-linux-gnu/librt.so" ]]; then
|
|||
sudo ln -s /usr/lib/x86_64-linux-gnu/librt.so.1 /usr/lib/x86_64-linux-gnu/librt.so
|
||||
fi
|
||||
org_pwd=$(pwd)
|
||||
if [[ $ubuntu_version =~ '14' ]]; then
|
||||
sudo apt install libgmp-dev -y
|
||||
fi
|
||||
sudo apt install -y libncurses5-dev libgmp-dev
|
||||
echo "postfix postfix/mailname string $USER" | sudo debconf-set-selections
|
||||
echo "postfix postfix/main_mailer_type string 'Local only'" | sudo debconf-set-selections
|
||||
sudo apt-get install -y postfix
|
||||
|
|
129
orbit_service.sh
129
orbit_service.sh
|
@ -42,8 +42,11 @@ sig () {
|
|||
get_orbit_root () {
|
||||
if [ ! -f $NGINX_ORBIT_SITES/$1 ]; then echo "Site $1 not found" && exit 0; fi
|
||||
ORBIT_ROOT=`cat $NGINX_ORBIT_SITES/$1 | grep 'root' | grep -v '#' | xargs | awk '{print $2}'`;
|
||||
ORBIT_ROOT=${ORBIT_ROOT//"/public;"/""};
|
||||
if [ ! -d $ORBIT_ROOT ]; then echo "Site folder $ORBIT_ROOT not fount"; fi
|
||||
ORBIT_ROOT="${ORBIT_ROOT//"/public;"/""}";
|
||||
if [ ! -d "$ORBIT_ROOT" ]; then
|
||||
echo "Site folder $ORBIT_ROOT not found";
|
||||
ORBIT_ROOT="";
|
||||
fi
|
||||
}
|
||||
|
||||
start_orbit () {
|
||||
|
@ -61,15 +64,23 @@ bundle_orbit () {
|
|||
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
|
||||
get_orbit_root $2;
|
||||
if [ ! -z "$ORBIT_ROOT" ]; then
|
||||
bundle_orbit;
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [ -e "/home/$ORBIT_USER/closed_sites.txt" ]; then
|
||||
closed_sites="$(cat /home/$ORBIT_USER/closed_sites.txt)";
|
||||
else
|
||||
closed_sites="";
|
||||
fi
|
||||
for APP in `ls -1 $NGINX_ORBIT_SITES`; do
|
||||
get_orbit_root $APP;
|
||||
if [ ! -z "$ORBIT_ROOT" ]; then
|
||||
if [[ ! "$closed_sites" =~ "$ORBIT_ROOT" ]]; then
|
||||
bundle_orbit;
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
|
@ -77,18 +88,26 @@ install)
|
|||
;;
|
||||
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
|
||||
get_orbit_root $2;
|
||||
if [ ! -z "$ORBIT_ROOT" ]; then
|
||||
start_orbit;
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [ -e "/home/$ORBIT_USER/closed_sites.txt" ]; then
|
||||
closed_sites="$(cat /home/$ORBIT_USER/closed_sites.txt)";
|
||||
else
|
||||
closed_sites="";
|
||||
fi
|
||||
for APP in `ls -1 $NGINX_ORBIT_SITES`; do
|
||||
get_orbit_root $APP;
|
||||
if [ ! -z "$ORBIT_ROOT" ]; then
|
||||
if [[ "$closed_sites" =~ "$ORBIT_ROOT" ]]; then
|
||||
echo "Stopping $ORBIT_ROOT";
|
||||
sig QUIT && continue;
|
||||
else
|
||||
start_orbit;
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
|
@ -108,14 +127,18 @@ stop)
|
|||
esac
|
||||
done
|
||||
if [ ! -z "$2" ]; then
|
||||
get_orbit_root $2
|
||||
echo "Stopping $ORBIT_ROOT"
|
||||
sig QUIT
|
||||
get_orbit_root $2;
|
||||
if [ ! -z "$ORBIT_ROOT" ]; then
|
||||
echo "Stopping $ORBIT_ROOT";
|
||||
sig QUIT;
|
||||
fi
|
||||
else
|
||||
for APP in `ls -1 $NGINX_ORBIT_SITES`; do
|
||||
get_orbit_root $APP;
|
||||
echo "Stopping $ORBIT_ROOT";
|
||||
sig QUIT && continue;
|
||||
get_orbit_root $APP;
|
||||
if [ ! -z "$ORBIT_ROOT" ]; then
|
||||
echo "Stopping $ORBIT_ROOT";
|
||||
sig QUIT && continue;
|
||||
fi
|
||||
done
|
||||
fi
|
||||
exit 0;
|
||||
|
@ -134,36 +157,48 @@ force-stop)
|
|||
esac
|
||||
done
|
||||
if [ ! -z "$2" ]; then
|
||||
get_orbit_root $2
|
||||
echo "Stopping $ORBIT_ROOT"
|
||||
sig TERM
|
||||
get_orbit_root $2;
|
||||
if [ ! -z "$ORBIT_ROOT" ]; then
|
||||
echo "Stopping $ORBIT_ROOT";
|
||||
sig TERM;
|
||||
fi
|
||||
else
|
||||
for APP in `ls -1 $NGINX_ORBIT_SITES`; do
|
||||
get_orbit_root $APP;
|
||||
echo "Stopping $ORBIT_ROOT";
|
||||
sig TERM && continue;
|
||||
get_orbit_root $APP;
|
||||
if [ ! -z "$ORBIT_ROOT" ]; then
|
||||
echo "Stopping $ORBIT_ROOT";
|
||||
sig TERM && continue;
|
||||
fi
|
||||
done
|
||||
fi
|
||||
exit 0;
|
||||
;;
|
||||
restart|reload)
|
||||
if [ ! -z "$2" ]; then
|
||||
get_orbit_root $2
|
||||
sig USR2 && echo "$ORBIT_ROOT reloaded OK" && exit 0
|
||||
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;
|
||||
get_orbit_root $2;
|
||||
if [ ! -z "$ORBIT_ROOT" ]; then
|
||||
sig USR2 && echo "$ORBIT_ROOT reloaded OK" && exit 0;
|
||||
echo >&2 "Couldn't reload $ORBIT_ROOT, starting instead";
|
||||
start_orbit;
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [ -e "/home/$ORBIT_USER/closed_sites.txt" ]; then
|
||||
closed_sites="$(cat /home/$ORBIT_USER/closed_sites.txt)";
|
||||
else
|
||||
closed_sites="";
|
||||
fi
|
||||
for APP in `ls -1 $NGINX_ORBIT_SITES`; do
|
||||
get_orbit_root $APP;
|
||||
if [ ! -z "$ORBIT_ROOT" ]; then
|
||||
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
|
||||
fi
|
||||
done
|
||||
fi
|
||||
exit 0;
|
||||
|
|
Loading…
Reference in New Issue