I'm porting a Debian init.d script to CentOS. In the Debian script, it uses start-stop-daemon for launching the process. The script uses start-stop-daemon's --group flag to change to a different group-id when starting the daemon process. How do I set the group-id of the daemon process in the init script on CentOS?
How do I set the group (gid) of a process I'm about to launch?
centos;init script
CentOS init scripts use /etc/init.d/functions, which declares a daemon function that most other init scripts use. But daemon doesn't accept any group flags.It ends up calling:$nice runuser -s /bin/bash - $user -c $corelimit >/dev/null 2>&1 ; $*A quick /sbin/runuser --help shows that runuser accepts a flag to specify group, so try:runuser -g $group; daemon ...