Hello. All files that begin with "S" in /etc/rc2.d are run with the
following command (re: /sbin/rc2 from SunOS 5.6);
for f in /etc/rc2.d/S*
{
if [ -s ${f} ]
then
case ${f} in
*.sh) . ${f} ;; # source it
*) /sbin/sh ${f} start ;; # sub shell
esac
fi
}
Note how it will attempt to run your program as;
/sbin/sh S88blah start
This means it is going to attempt to run your process as a shell script
regardless of what it is. In general, it is good practice to have
start/stop scripts for your program in the rc directories.
case "$1" in
start) blah ;;
stop) pkill blah ;;
esac
pkill is introduced in SunOS 5.7. If you are using 5.6 like me, simply
write something to find your process id. For example;
pid=`ps -aef | awk '/[b]lah/ {print $2}'`
kill $pid
Make sure whatever you use to find the pid matches EXACTLY what you are
looking for. kill does so indiscriminately.
Take care.
Ryan Tennant
DevUnix.org
> I'm starting a process on a Solaris 7 from /etc/rc2.d
> I don't use a shell script, just a compiled binary:
> /etc/rc2.d/S88blah
> #include <unistd.h>
> main()
> { execl("/usr/lib/blah","blah",(char *)0); }
> It executes all fine when I do it by hand and puts the process in the
> background.
> However, it doesn't execute at boot-time.
> S88 should be late enough for everything to be available, I put it
> straight after S88utmpd which executes from /usr/lib too and utmpd
> starts alright.
> Any clue would be much appreciated.
> Thanks.