My interesting problem is that when running some
rc.d scripts they do not actually drop back to the root shell, but leave me at an intermediate shell as the user they're supposed to be running as.
A side effect is that the desired service doesn't actually start until I
exit from this inner shell. See below:
[root@zeb2 /usr/local/etc/rc.d]# ./mysql-server start Starting mysql. [mysql@zeb2 /usr/local/etc/rc.d]$ ps ax |grep mysql 3352 0 S 0:00.01 /bin/sh ./mysql-server start 3357 0 S 0:00.01 su -m mysql -c sh -c "/usr/sbin/daemon -c -f /usr/local/bin/mysqld_safe --defaults-extra-file=/var/db/mysq 3358 0 S 0:00.01 _su -m -c sh -c "/usr/sbin/daemon -c -f /usr/local/bin/mysqld_safe --defaults-extra-file=/var/db/mysql/my. 3364 0 R+ 0:00.00 grep mysql [mysql@zeb2 /usr/local/etc/rc.d]$ exit exit [root@zeb2 /usr/local/etc/rc.d]# ps ax |grep mysql 3366 ?? Ss 0:00.02 /bin/sh /usr/local/bin/mysqld_safe --defaults-extra-file=/var/db/mysql/my.cnf --user=mysql --datadir=/var/d 3636 ?? S 0:00.13 [mysqld] 3639 0 S+ 0:00.00 grep mysql [root@zebes2 /usr/local/etc/rc.d]#
It's almost like there is some wierdness with the
su command that is the problem. This doesn't happen on every port I've installed, but happens for both
SABNzbd. This also causes a problem if the server needs to reboot and I've left the service enabled in
rc.conf as it will enter the inner shell and hang the boot until I can login locally and type exit.
[root@zeb2 /usr/local/etc/rc.d]# uname -a FreeBSD xxx.xxx.xxx.net 9.0-RELEASE-p3 FreeBSD 9.0-RELEASE-p3 #0: Tue Jun 12 01:47:53 UTC 2012 firstname.lastname@example.org:/usr/obj/usr/src/sys/GENERIC i386
Updated with rc.conf output below
[root@zeb2 /usr/bin]# cat /etc/rc.conf |grep -v '#' syslogd_flags="-a dd-wrt.om.cox.net:* -vv" sshd_enable="YES" ifconfig_em0="inet 192.168.1.3 netmask 255.255.255.0" defaultrouter="192.168.1.1" hostname="zeb2.om.cox.net" webmin_enable="YES" samba_enable="YES" uuidd_enable="YES" denyhosts_enable="YES" inetd_enable="YES" mysql_enable="YES"
Update 2 with outputs requested
Update 3 with answer!
@Steve Wills got me looking in the right direction. The ultimate cause was because I was invoking the bash shell from the end of
.cshrc for the root account. This file must get parsed when running su through the
rc.d scripts and the added reference to another shell explains why it would sit and wait for me to
exit. After removing the reference, the rc.d scripts began working as expected.