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