fix start script
This commit is contained in:
@@ -28,7 +28,7 @@ chmod +x /etc/init.d/racecore-nginx
|
||||
/etc/init.d/racecore-nginx start
|
||||
```
|
||||
|
||||
The custom init script is useful when Teltonika's bundled `nginx-util` is missing.
|
||||
The custom init script is useful when Teltonika.s bundled `nginx-util` is missing. It discovers Nginx in the firmware PATH, including `/usr/local/usr/sbin/nginx`, before checking standard paths.
|
||||
It recreates all RAM-backed Nginx temporary directories under `/tmp` on every boot,
|
||||
validates the config, and starts Nginx under `procd`.
|
||||
|
||||
|
||||
@@ -4,14 +4,26 @@ START=95
|
||||
STOP=10
|
||||
USE_PROCD=1
|
||||
|
||||
NGINX_BIN="/usr/sbin/nginx"
|
||||
NGINX_BIN=""
|
||||
NGINX_CONF="/etc/nginx/nginx.conf"
|
||||
|
||||
resolve_nginx() {
|
||||
for candidate in "$(command -v nginx 2>/dev/null)" /usr/local/usr/sbin/nginx /usr/sbin/nginx /usr/bin/nginx; do
|
||||
if [ -n "$candidate" ] && [ -x "$candidate" ]; then
|
||||
NGINX_BIN="$candidate"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
logger -t racecore-nginx "nginx executable not found"
|
||||
return 1
|
||||
}
|
||||
|
||||
prepare_runtime() {
|
||||
mkdir -p /tmp/nginx/client_body /tmp/nginx/proxy /tmp/nginx/fastcgi /tmp/nginx/uwsgi /tmp/nginx/scgi
|
||||
}
|
||||
|
||||
start_service() {
|
||||
resolve_nginx || return 1
|
||||
prepare_runtime
|
||||
"$NGINX_BIN" -t -c "$NGINX_CONF" || return 1
|
||||
procd_open_instance
|
||||
@@ -24,6 +36,7 @@ start_service() {
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
resolve_nginx || return 1
|
||||
prepare_runtime
|
||||
"$NGINX_BIN" -t -c "$NGINX_CONF" || return 1
|
||||
"$NGINX_BIN" -s reload -c "$NGINX_CONF"
|
||||
|
||||
Reference in New Issue
Block a user