pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Question about an rc.d script in a package



Hello,

I am creating a pkgsrc package for education purposes. The application
it packages consists of a shell script that controls a daemon process
and a client script that connects to that daemon. I want to manage the
daemon process via rc.d. The control script has actions to start, stop
and give the status of the daemon process. The start action saves the
pid of the daemon process that it starts in the background, the status
action prints the pid, and the stop action kills the pid.

I created a working rc.d script that simply wraps my control script. I
feel that the latter duplicates a lot of functionality already
implemented in rc.subr and I would like to eliminate the duplication.

The application is at https://github.com/rambius/ncatchat.
https://github.com/rambius/ncatchat/blob/main/ncatchatsrv.sh uses the
ncat command from nmap to start a chat server.
https://github.com/rambius/ncatchat/blob/main/ncatchat.sh is the
client that uses again the ncat command to connect to the server.

The pkgsrc package is at https://github.com/rambius/pkgsrc-ncatchat.
It uses NO_BUILD=YES, because it has nothing to build. It declares
nmap as a dependency, because it takes the ncat command from it. It
adds ncatchatd as an rc.d script to RCD_SCRPTS. The rc.d script
resides in files/ncatchatd.sh at
https://github.com/rambius/pkgsrc-ncatchat/blob/main/chat/ncatchat/files/ncatchatd.sh.
I set PKG_RCD_SCRIPTS=yes in /etc/mk.conf and it copies the rc.d
script directly to /etc/rc.d/ncatchatd on "make install".

Everything works fine, but I saw some other rc.d scripts defining a
variable "pidfile=..." and they let rc.d systems handles the status
and stop commands and I would like to use this approach if possible.

I am doing all this to get more familiar with pkgsrc and with rc.d
system. I would be very grateful for your help and for your
suggestions how to make that package better.

Regards
rambius

-- 
Tangra Mega Rock: http://www.radiotangra.com


Home | Main Index | Thread Index | Old Index