The penny just dropped, if I do: pidof php5 data.php the PID is returned.
Looks like the initial problem ... ie from the directory that data.php is in, that it couldn't be invoked by ./data.php but worked with php5 data.php seems to influence how pidof now works. Well, looks like I have a work-around. Thanks, Dave > Date: Mon, 2 Mar 2015 10:56:48 +0100 > From: m...@pengutronix.de > To: j...@pengutronix.de; oselas@community.pengutronix.de > CC: dave_fest...@hotmail.com > Subject: Re: [oselas] Latest mini2440BSP bash pidof problems > > On 03/02/2015 10:54 AM, Juergen Borleis wrote: > > On Monday 02 March 2015 10:38:42 Marc Kleine-Budde wrote: > >> On 03/02/2015 10:30 AM, Juergen Borleis wrote: > >>> Maybe you should do more validating tests. > >>> > >>> PROC_TO_KILL=`pidof data.hhp` > >>> if [ -n "${PROC_TO_KILL}" ]; then > >>> ps "${PROC_TO_KILL}" > /dev/null > >>> if [ $? -eq 0 ]; then > >>> kill "${PROC_TO_KILL}" > >>> fi > >>> fi > >> > >> This is all racy, > > > > Sure. But better than not to check. > > > >> what about pkill? > > > > Killing processes via pattern sounds like a horror to me. The correct > > solution > > What's the difference to pidof? pkill and pgrep have even more ways to > specify the pattern. > > > would be to make the "data.php" provides its own PID file to kill the > > correct > > process instead of guessing it. Just an idea. > > ACK, or use systemd. > > Marc > > -- > Pengutronix e.K. | Marc Kleine-Budde | > Industrial Linux Solutions | Phone: +49-231-2826-924 | > Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | > Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | >