path: lsb_11.6/init-functions status="0" pidofproc $pidfile $daemon >/dev/null || status="$?" if [ "$status" = 0 ]; then log_success_msg "$name is running" path: lsb_11.6/init-functions if [ "$status" = 0 ] && [ "$is_term_sig" ] && [ "$pidfile" ]; then pidofproc -p "$pidfile" "$1" >/dev/null || rm -f "$pidfile" fi return 0 path: lsb_11.6/init-functions } pidofproc () { local pidfile base status specified pid OPTIND pidfile= path: lsb_11.6/init-functions } # start-stop-daemon uses the same algorithm as "pidofproc" above. killproc () { local pidfile sig status base name_param is_term_sig OPTIND path: lsb_11.6/init-functions else # pid file doesn't exist, try to find the pid nevertheless if [ -x /bin/pidof ] && [ ! "$specified" ]; then status="0" /bin/pidof -c -o %PPID -x $1 || status="$?" path: lsb_11.6/init-functions if [ -x /bin/pidof ] && [ ! "$specified" ]; then status="0" /bin/pidof -c -o %PPID -x $1 || status="$?" if [ "$status" = 1 ]; then return 3 # program is not running path: lsb_11.6/test/minid.initd status) echo -n "Checking for service $DAEMON " pidofproc $DAEMON 2>&1 >/dev/null RETVAL=$? ;; path: lsb_11.6/test/init-skeleton ;; status) # Use pidofproc to check the status of the service, # pidofproc returns the exit status code of 0 when it the process is # running. path: lsb_11.6/test/init-skeleton # Source LSB init functions # This provides start_daemon, killproc, pidofproc, # log_success_msg, log_failure_msg and log_warning_msg. . /lib/lsb/init-functions path: lsb_11.6/test/init-skeleton status) # Use pidofproc to check the status of the service, # pidofproc returns the exit status code of 0 when it the process is # running. path: lsb_11.6/test/lsb-test.sh echo " Simple check, no options:" pidofproc nonexistent RETVAL=$? if [ $RETVAL -ne 3 ]; then path: lsb_11.6/test/lsb-test.sh echo "OK!" # Test pidofproc sanity checking. echo "Testing pidofproc command line checks" path: lsb_11.6/test/lsb-test.sh # Test pidofproc sanity checking. echo "Testing pidofproc command line checks" echo " Simple check, no options:" path: lsb_11.6/test/lsb-test.sh echo " With -p option, but in wrong place:" pidofproc nonexistent -p /var/run/nonexist.pid RETVAL=$? if [ $RETVAL -ne 4 ]; then path: lsb_11.6/test/lsb-test.sh echo " With -p option:" pidofproc -p /var/run/nonexist.pid nonexistent RETVAL=$? if [ $RETVAL -ne 3 ]; then path: lsb_11.6/debian/changelog * No longer use --retry in start-stop-daemon calls. (Closes: #451529) * Fix behavior of killproc and pidofproc when no pidfile is passed in. * Call pidof with -x to include scripts that may be daemonized. * Change dependencies *cupsys* -> *cups*. (Closes: #490381) path: lsb_11.6/debian/changelog in-the-wild variations that omit messages. * No longer use --retry in start-stop-daemon calls. (Closes: #451529) * Fix behavior of killproc and pidofproc when no pidfile is passed in. * Call pidof with -x to include scripts that may be daemonized. * Change dependencies *cupsys* -> *cups*. (Closes: #490381) path: lsb_11.6/debian/changelog * killproc() returns 0 if a signal is not specified and the program is not running. (Closes: #379387) * Divert output in pidofproc test to /dev/null. (Closes: #381821) * Test tput setaf 1 in log_use_fancy_output(). (Closes: #375644) * Fix call to getopts in start_daemon to properly work with command path: lsb_11.6/debian/changelog * Removed support for the $netdaemons facility, which vanished from the specification. Hopefully nobody is using it... * Call pidof if it's available and /var/run/$1.pid doesn't exist. -- Chris Lawrence Tue, 2 Jul 2002 19:48:35 -0500 path: lsb_11.6/debian/changelog lsb (3.1-9) unstable; urgency=high * Add missing < "$pidfile" to read in pidofproc(). (Closes: #370155) -- Chris Lawrence Sun, 4 Jun 2006 04:08:31 -0400 path: lsb_11.6/debian/changelog * Support Should-Start and Should-Stop from gLSB 1.9. (Closes: #198277) (A warning message will be output if a facility requested is unavailable.) * Support -p argument to killproc, pidofproc and start_daemon, per gLSB 1.9. (Closes: #197794) * Set up the ld-lsb symlink in the postinst, so it can vary between path: lsb_11.6/debian/changelog * Add po-debconf patch. (Closes: #186853) * Don't retry if a signal specified in killproc. (Closes: #167759) * Revise pidofproc to return a failure code if no pid found. (Closes: #190719) * Properly treat Required-Start and Required-Stop as strict dependencies path: lsb_11.6/debian/changelog * Correct a bug number in the 3.2+Debian30 upload. * Promote lsb-release to Priority: optional. * Fix both unused and undeclared local variables in pidofproc. (Closes: #663351) path: lsb_11.6/debian/changelog * Fix killproc() to work if signal isn't specified; also fix the pidfile check in both killproc() and pidofproc(). (Closes: #370075) -- Chris Lawrence Sat, 3 Jun 2006 02:45:55 -0400 path: lsb_11.6/debian/changelog - Move information from NEWS.Debian to README.Debian, enhance it. * pidofproc(): Make sure to try /bin/pidof when no pidfile is specified. (Closes: #668958) * In killproc(), make sure to exit 0 when the program is not running path: lsb_11.6/debian/changelog [ Jeff Licquia ] * Sanity-check pidofproc parameters. (Closes: #691422) -- Didier Raboud Mon, 12 Nov 2012 08:58:04 +0100 path: lsb_11.6/debian/changelog * Improve release comparison function when 'suite' is missing from sources.list. (Closes: #597667) * return 3 in pidofproc() if we can't track down a running copy of the process and the pidfile is missing. (Closes: #597628) * Correct location of README.Debian.gz in lsb(8). (Closes: #589100) path: lsb_11.6/debian/changelog lsb (1.2-3) unstable; urgency=low * Return non-zero exit status if "pidofproc" can't find the process. (Closes: #157314) path: lsb_11.6/debian/changelog * Change working directory to $PWD in start-stop-daemon, for better compatibility with LSB applications. (Closes: #519817) * return 3 rather than 4 in pidofproc if a PID file is specified and the daemon is not found. (Closes: #494623) * Improve handling of future testing versions unknown to lsb-release. path: lsb_11.6/debian/changelog * Revert change in 3.2-16 that broke killproc due to my misunderstanding of the spec. (Closes: #495587) * pidofproc now also checks for /var/run/$base.pid if -p is not specified, fixing conformance with the spec. path: lsb_11.6/debian/changelog (closes: #381687) * log_use_fancy_output is now overridable by admin (closes: #374780) * pidofproc actually checks if process is running (closes: #381684) (probably closes: #167757) * Use shell built-in getopts instead of /usr/bin/getopt (closes: #335216) path: lsb_11.6/debian/changelog [ Harald Dunkel ] * pidofproc: use "pidof -c" to avoid pidofproc results from containers or chroots (Closes: #888743) path: lsb_11.6/debian/changelog introduced by glibc 2.3.5. * Require Python 2.3 or later, so we can use optparse. * Fix test in pidofproc in /lib/lsb/init-functions. (Closes: #315067) * Document /etc/profile.d lossage in README.Debian. * Remove stale link in README.Debian. (Closes: #316064) path: lsb_11.6/debian/changelog lsb (3.2-14) unstable; urgency=low * Update pidofproc(), status_of_proc() to sync with Ubuntu. Thanks to Dustin Kirkland. (Closes: #490095) * Add hooks to init-functions, thanks to Miroslav Jezbera. path: lsb_11.6/debian/changelog * Replace uses of $n with ${n:-} where $n could be unbound. (Closes: #369193) * Use pidof only if pid file is not specified. (Closes: #365736) -- Chris Lawrence Thu, 1 Jun 2006 14:20:24 -0400 path: lsb_11.6/debian/changelog lsb (3.1-15) unstable; urgency=low * Fix assignment to $opt in pidofproc(). (Closes: #384540) -- Chris Lawrence Thu, 24 Aug 2006 19:08:02 -0500 path: lsb_11.6/debian/changelog * Include status_of_proc() function from Ubuntu's lsb-base. Thanks to Dustin Kirkland. (Closes: #483285) * This patch also allows pidofproc to work on other users' processes. (Closes: #452992) * Fix output of lsb_release -h to properly describe what -s does. path: lsb_11.6/debian/changelog * Improve documentation of killproc(). (Closes: #384814) * Also improve documentation of pidofproc() in the same vein. * Move lsb_release to /usr. (Closes: #389380) * Modify log_use_fancy_output() to only test once for a fancy TTY; patch