On Wed, 2024-07-17 at 15:05 +0300, Zurab Kvachadze wrote: > > +NGINX_CONFIGFILE=${NGINX_CONFIGFILE:-/etc/nginx/nginx.conf} > +pidfile=${NGINX_PIDFILE:-/run/nginx.pid}
OpenRC allows you to run multiple instances of the same service by creating symlinks in /etc/init.d. For example, I might symlink nginx- internal to nginx, and then run, # rc-service nginx-internal start The two configurable variables above make this possible, but require the user to create a new /etc/conf.d/nginx-internal file to override them. It would be a small improvement to use $RC_SVCNAME instead of "nginx" as the default. That way, for the new service, they would be /run/nginx-internal.pid and /etc/nginx/nginx-internal.conf. In fact, I would delete the NGINX_PIDFILE variable entirely, leaving it at /run/${RC_SVCNAME}.pid. There's no reason for anyone to change it. You can force the daemon to use that path with -g "pid ${pidfile}", relieving you of the responsibility to coordinate with the config file. > +depend() { > + need net > + use dns logger netmount > +} I don't think "need net" is right here because nginx starts fine on localhost or 0.0.0.0 until you configure it to use a specific address. There's a section called "Be wary of 'need net' dependencies" in, /usr/share/doc/openrc-*/service-script-guide.md.bz2 that talks about this. > +start_pre() { > + checkpath -d -o root:root /var/tmp/nginx || return 1 > +} > + The old script had, if [ "${RC_CMD}" != "restart" ]; then configtest || return 1 fi here. If "nginx -t" produces better error messages that plain nginx, that might be the reason. But otherwise it's redundant.