rc startup file questions

Kade Cole kadecole at gmail.com
Fri Apr 22 15:43:05 UTC 2016


I am working on a new rc file for starting rtty. I have it working for
startup but it is not working for other arguments (status, stop). Part of
the problem I am having is that when rtty starts it calls ttysrv for the
devices you have configured in /usr/local/rtty/dev and starts a process of
ttysrv for each file in /dev. rtty then also creates multiple pid files in
/usr/local/rtty/pid for each service started. It seems that I can not
figure out how to deal with these multiple pid files. If only one process
of ttysrv is started then everything works. If more than one process is
started I get the error  "WARNING: no shebang line in" the second pid file.

I was wondering if anyone has any suggestions on how to write a custom
rtty_status or rtty_stop to deal with multiple pid files in a directory.
Thanks for your help. Below is the current rc script I have been trying.

#!/bin/sh

# PROVIDE: rtty
# REQUIRE: DAEMON usb
# BEFORE:  LOGIN
# KEYWORD: shutdown

. /etc/rc.subr

name=rtty
rcvar=rtty_enable

command="/usr/local/rtty/bin/startsrv"
procname="/usr/local/rtty/bin/ttysrv"
pidfile="/usr/local/rtty/pid/*"

start_cmd="${name}_start"


rtty_start(){
    echo "starting rtty."
    cd /usr/local/rtty/dev
    ${command} *
}

load_rc_config $name
run_rc_command "$1"


More information about the freebsd-rc mailing list