Skip to content

Commit

Permalink
Respect custom configuration file locations
Browse files Browse the repository at this point in the history
This allows administrator to redefine a custom location for a
configuration file to be used during upgrade and startup.

References: #24
  • Loading branch information
thresheek committed Jan 7, 2025
1 parent 1fd6752 commit 4a63950
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 7 deletions.
5 changes: 4 additions & 1 deletion debian/debian/nginx-debug.default
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Defaults for nginx initscript
# Defaults for nginx-debug
# sourced by /etc/init.d/nginx-debug
# included by nginx-debug systemd service
NAME="nginx-debug"
DESC="nginx-debug"
DAEMON="/usr/sbin/nginx-debug"

# Additional options that are passed to nginx
DAEMON_OPTS=""

# CONFFILE="/etc/nginx/nginx.conf"
4 changes: 3 additions & 1 deletion debian/debian/nginx-debug.service
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ Wants=network-online.target
[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStart=/usr/sbin/nginx-debug -c /etc/nginx/nginx.conf
Environment="CONFFILE=/etc/nginx/nginx.conf"
EnvironmentFile=-/etc/default/nginx-debug
ExecStart=/usr/sbin/nginx-debug -c ${CONFFILE}
ExecReload=/bin/sh -c "/bin/kill -s HUP $(/bin/cat /var/run/nginx.pid)"
ExecStop=/bin/sh -c "/bin/kill -s TERM $(/bin/cat /var/run/nginx.pid)"

Expand Down
5 changes: 4 additions & 1 deletion debian/debian/nginx.default
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Defaults for nginx initscript
# Defaults for nginx
# sourced by /etc/init.d/nginx
# included by nginx systemd service

# Additional options that are passed to nginx
DAEMON_ARGS=""

# CONFFILE="/etc/nginx/nginx.conf"
4 changes: 3 additions & 1 deletion debian/debian/nginx.service
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ Wants=network-online.target
[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf
Environment="CONFFILE=/etc/nginx/nginx.conf"
EnvironmentFile=-/etc/default/nginx
ExecStart=/usr/sbin/nginx -c ${CONFFILE}
ExecReload=/bin/sh -c "/bin/kill -s HUP $(/bin/cat /var/run/nginx.pid)"
ExecStop=/bin/sh -c "/bin/kill -s TERM $(/bin/cat /var/run/nginx.pid)"

Expand Down
4 changes: 3 additions & 1 deletion rpm/SOURCES/nginx-debug.service
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ Wants=network-online.target
[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStart=/usr/sbin/nginx-debug -c /etc/nginx/nginx.conf
Environment="conffile=/etc/nginx/nginx.conf"
EnvironmentFile=-/etc/sysconfig/nginx
ExecStart=/usr/sbin/nginx-debug -c ${conffile}
ExecReload=/bin/sh -c "/bin/kill -s HUP $(/bin/cat /var/run/nginx.pid)"
ExecStop=/bin/sh -c "/bin/kill -s TERM $(/bin/cat /var/run/nginx.pid)"

Expand Down
4 changes: 3 additions & 1 deletion rpm/SOURCES/nginx.service
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ Wants=network-online.target
[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf
Environment="conffile=/etc/nginx/nginx.conf"
EnvironmentFile=-/etc/sysconfig/nginx
ExecStart=/usr/sbin/nginx -c ${conffile}
ExecReload=/bin/sh -c "/bin/kill -s HUP $(/bin/cat /var/run/nginx.pid)"
ExecStop=/bin/sh -c "/bin/kill -s TERM $(/bin/cat /var/run/nginx.pid)"

Expand Down
2 changes: 1 addition & 1 deletion rpm/SOURCES/nginx.upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fi

prog=nginx
nginx=/usr/sbin/nginx
conffile=/etc/nginx/nginx.conf
conffile=${conffile:-/etc/nginx/nginx.conf}
pidfile=`/usr/bin/systemctl show -p PIDFile nginx.service | sed 's/^PIDFile=//' | tr ' ' '\n'`
SLEEPSEC=${SLEEPSEC:-1}
UPGRADEWAITLOOPS=${UPGRADEWAITLOOPS:-5}
Expand Down

0 comments on commit 4a63950

Please sign in to comment.