forked from Spark/ssm-services
34 lines
573 B
Plaintext
Executable File
34 lines
573 B
Plaintext
Executable File
#!/usr/bin/env watchman
|
|
|
|
service_command='/usr/bin/nginx'
|
|
service_pidfile='/run/nginx.pid'
|
|
|
|
nginx.test_config() { "$service_command" -tq; }
|
|
|
|
reload() {
|
|
nginx.test_config || {
|
|
watchman.err "Nginx config test failed, not reloading."
|
|
return 1
|
|
}
|
|
|
|
watchman.reload
|
|
}
|
|
|
|
restart() {
|
|
nginx.test_config || {
|
|
watchman.err "Nginx config test failed, not restarting."
|
|
return 1
|
|
}
|
|
|
|
stop; start
|
|
}
|
|
|
|
upgrade() {
|
|
nginx.test_config || {
|
|
watchman.err "Nginx config test failed, not upgrading."
|
|
return 1
|
|
}
|
|
|
|
kill -12 "$service_pid"
|
|
}
|