salix/services/nginx/start.sh

26 lines
555 B
Bash
Executable File

#!/bin/bash
nginxBin="/usr/sbin/nginx"
nginxPrefix="${PWD}/services/nginx"
nginxConf="$nginxPrefix/temp/nginx.conf"
if [ ! -f $nginxBin ]; then
nginxBin="nginx"
fi
case "$1" in
start|"")
$0 stop
echo "Starting nginx."
mkdir -p "$nginxPrefix/temp"
"$nginxBin" -c "$nginxConf" -p "$nginxPrefix" 2>> /dev/null
;;
stop)
echo "Stoping nginx."
"$nginxBin" -c "$nginxConf" -p "$nginxPrefix" -s stop 2>> /dev/null
;;
*)
echo "Usage: `basename "$0"` [start|stop]"
exit 1
esac