User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; fr; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7 Build Identifier: I needed to create initscripts for two different versions of the same service, namely UnrealIrcd. Here's the script : opts="rehash start stop" PID_FILE="${IRCDPATH}/ircd.pid" depend() { use dns net } start() { ebegin "Starting unrealircd" start-stop-daemon --start --quiet --exec ${IRCDPATH}/src/ircd \ --chuid smokey --pidfile $PID_FILE --user smokey &>/dev/null eend $? } stop() { ebegin "Shutting down unrealircd" start-stop-daemon --stop --quiet --exec ${IRCDPATH}/src/ircd \ --pidfile $PID_FILE --user smokey &>/dev/null eend $? } rehash() { ebegin "Re-Loading unrealircd" start-stop-daemon --stop --exec ${IRCDPATH}/src/ircd \ --pidfile $PID_FILE --user smokey --signal HUP &>/dev/null eend $? } Of course /etc/conf.d/smokey-ircd exists and has IRCDPATH in it. The problem is that if I call "/etc/init.d/smokey-ircd rehash" while smokey-ircd is *NOT* running but, say foo-ircd is running, then the script will rehash foo-ircd instead, in spite of the different user and path of the exec. Reproducible: Always Steps to Reproduce: 1. Install two versions of a service in two different paths 2. Create initscripts using start-stop-daemon with --user, with a reload option that uses --stop and --signal (HUP for example) 3. Try reloading a non-running service Actual Results: The script sent the HUP signal to the other instance of the service, disregarding the fact that : - there was no pidfile - the user was not the same - the path was not the same Expected Results: start-stop-daemon should havs stopped without doing anything, as it said it would when using --test : daria init.d # ./smokey-ircd rehash * Caching service dependencies ... [ ok ] * Re-Loading unrealircd ... No /home/smokey/Unreal3.2/src/ircd found running; none killed. [ !! ] Portage 2.1.1-r1 (default-linux/amd64/2006.1, gcc-4.1.1, glibc-2.4-r3, 2.6.18-vs2.0.2-gentoo-r8-smokey x86_64) ================================================================= System uname: 2.6.18-vs2.0.2-gentoo-r8-smokey x86_64 Intel(R) Celeron(R) CPU 2.66GHz Gentoo Base System version 1.12.5 Last Sync: Thu, 12 Oct 2006 22:00:01 +0000 ccache version 2.3 [enabled] app-admin/eselect-compiler: [Not Present] dev-java/java-config: [Not Present] dev-lang/python: 2.4.3-r4 dev-python/pycrypto: 2.0.1-r5 dev-util/ccache: 2.3 dev-util/confcache: [Not Present] sys-apps/sandbox: 1.2.17 sys-devel/autoconf: 2.13, 2.59-r7 sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2 sys-devel/binutils: 2.16.1-r3 sys-devel/gcc-config: 1.3.13-r4 sys-devel/libtool: 1.5.22 virtual/os-headers: 2.6.11-r2 ACCEPT_KEYWORDS="amd64" AUTOCLEAN="yes" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -pipe -march=nocona -fomit-frame-pointer" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /var/bind" CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/revdep-rebuild /etc/terminfo" CXXFLAGS="-O2 -pipe -march=nocona -fomit-frame-pointer" DISTDIR="/usr/portage/distfiles" FEATURES="autoconfig ccache distlocks metadata-transfer parallel-fetch sandbox sfperms strict" GENTOO_MIRRORS="http://mirror.ovh.net/gentoo-distfiles/ ftp://mirror.ovh.net/gentoo-distfiles/" LANG="en_US" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude='/distfiles' --exclude='/local' --exclude='/packages'"PORTAGE_TMPDIR="/var/tmp"PORTDIR="/usr/portage"PORTDIR_OVERLAY="/usr/local/portage-ovh"SYNC="rsync://rsync.gentoo.org/gentoo-portage"USE="amd64 acl apache2 bash-completion berkdb bzip2 chroot cli crypt cups curl dba dbm dlloader elibc_glibc emacs emul-linux-x86 fortran ftp gd gdbm gpm iconv imap input_devices_evdev input_devices_keyboard input_devices_mouse ipv6 ipv6arpa kernel_linux libg++ libwww logrotate maildir mbox mime multiuser mysql mysqli ncurses netboot nls nptl nptlonly pam pcre pdf perl pg-hier php pop pop3d posix postfix postgres ppds python rar razor readline reflection sasl session sockets spamassassin spl ssl tcpd threads tokenizer udev unicode unzip userland_GNU userlocales vhosts video_cards_via xml xmlreader xmlrpc xmlwriter xsl zip zlib"Unset: CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_RSYNC_EXTRA_OPTS
Define a default IRCDPATH just incase it's missing from the config file Remove the --quiet options except for the one in stop() Add the --oknodo option to in rehash() Don't pipe stuff to /dev/null Also, you'll probably need to wait for baselayout-1.13.0_alpha2 as I think you'll also need the fix in bug #72145
baselayout is now fixed for this, so over to the net-irc team
I've not been able to reproduce the behaviour of start-stop-daemon to kill the wrong processes. It correctly identifies the processes here.