linux - run master process as root
This commit is contained in:
parent
deb28c5991
commit
2c9c9fb62c
@ -4,7 +4,11 @@ function do_and_check_cmd() {
|
|||||||
if [ "$CHANGE_DIR" != "" ] ; then
|
if [ "$CHANGE_DIR" != "" ] ; then
|
||||||
cd "$CHANGE_DIR"
|
cd "$CHANGE_DIR"
|
||||||
fi
|
fi
|
||||||
output=$(su -s "/bin/bash" -c "$1" nginx 2>&1)
|
if [ "$AS_ROOT" != "" ] ; then
|
||||||
|
output=$("$@" 2>&1)
|
||||||
|
else
|
||||||
|
output=$(su -s "/bin/bash" -c "$1" nginx 2>&1)
|
||||||
|
fi
|
||||||
ret="$?"
|
ret="$?"
|
||||||
if [ $ret -ne 0 ] ; then
|
if [ $ret -ne 0 ] ; then
|
||||||
echo "[!] Error from command : $*"
|
echo "[!] Error from command : $*"
|
||||||
@ -42,7 +46,7 @@ if [ -f "/tmp/nginx.pid" ] ; then
|
|||||||
# Otherwise start it
|
# Otherwise start it
|
||||||
else
|
else
|
||||||
echo "[*] Start nginx"
|
echo "[*] Start nginx"
|
||||||
do_and_check_cmd "nginx -g 'daemon on;'"
|
AS_ROOT="yes" do_and_check_cmd nginx -g 'daemon on; user nginx;'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run post-jobs
|
# Run post-jobs
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user