Hi Dave,

On Saturday 28 February 2015 08:11:20 Dave Festing wrote:
> Upgraded a system that has been working nicely with the previous BSP and
> 3.7 and having a few problems.
>
> My main PHP script starts with:
>
> #!/usr/bin/php5
>
> <?php
> ...
>
> and the error I get when I invoke:
>
> ./data.php   (from the directory where this script is located) is
>
> ./data.php line 3: ?php: No such file or directory
>
> I can work around this problem by calling:
>
> php5 data.php

Just a guess: is the php5 interpreter still located in "/usr/bin" on your 
system after the update?

> The issue that I have not been able to work-around is, that in another
> script I ensure that data.php is killed before trying to start it again.
>
> So, in an initialise script I have:
>
> #!/bin/bash
>
> kill `pidof data.php`
> ...
>
> and the error I get is:
>
> kill: usage: [-s sigspec | -n signum | -sigspec] pid | jobspec ...
> or kill -l [sigspec]

This means the "`pidof data.php`" seems to expand to nothing or an error 
message which the kill command cant handle.
 a) is the pidof command present on your target?
 b) if you run "pidof data.php" manually: what does it output?

Note: 'pidof' outputs more than one PID if it finds more than one process with 
this name. And 'kill' can handle only one PID per call I guess.

> The usage does not correspond to the usage options listed in the Busybox
> docs for kill, so I am confused.
>
> I have Googled and tried many other kill examples to no avail.
>
> I have tried php, bash, awk from the previous working system to no avail
> either.  I also tried disabling Busybox ash as initially I was getting ash
> warnings when running the bash script, which also confused me. I also read
> that pidof might not operate correctly on running scripts.
>
> Should I try maintaining a list of PIDS and then refer to that list when I
> want to kill my data.php?

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

> Something has changed, any suggestions appreciated.

And many shell code is made for "bash" or "sh". It might conflict with "ash".

Regards,
Juergen

-- 
Pengutronix e.K.                              | Juergen Borleis             |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |

Reply via email to