On Fri, Jun 21, 2019 at 03:57:41PM -0400, Jacob Adams wrote:
> I've got a shell script I'd like to run as a system service. Due to the
> 16 character limitation on pgrep and the -x flag that rc.subr passes to
> check by default, I can't get check or stop to work correctly. The
> problem is that the process name looks like "/bin/sh
> /usr/local/bin/script.sh" which, even if passed to pgrep, won't match
> when -x is used.
> 
> My rc.d script currently looks like this:
> 

Hi.

That should not be an issue, that's why pexp is used for.
But without more context it's hard to know how to help you.

I can match sh scripts without issue:
$ pgrep -xf "/bin/sh /etc/gdm/Xsession /usr/local/bin/gnome-session"
77289

Are you sure your entire process line is "bin/sh /usr/local/bin/authmail"?
We don't run into the 16 chars  limitation when using -xf


> #!/bin/ksh
> 
> AUTHMAIL="/usr/local/bin/authmail"
> daemon=${AUTHMAIL}
> daemon_timeout=1
> 
> . /etc/rc.d/rc.subr
> 
> rc_reload=NO
> rc_bg=YES
> pexp="/bin/sh ${AUTHMAIL}"
> 
> rc_cmd $1
> 
> Do I have any other options, or do I just need to override rc_check to
> remove -x?
> 
> 

-- 
Antoine

Reply via email to