[ELDK] Kill strange behaviour in a script
Jeffrey Haemer
jeffrey.haemer at gmail.com
Mon Aug 4 18:01:23 CEST 2008
Giuseppe,
I just tested the possibility that you're seeing a quirk of busybox or the
busybox shell (ash). Here's the experiment:
# install busybox and link it, locally, to "sh"
sudo apt-get install busybox
ln /usr/bin/busybox ~/Desktop/sh
# Now change both scripts to use the busybox shell
perl -i -pe "s(/bin/sh)($HOME/Desktop/sh)" example.sh flash.sh
# and execute them
./example.sh
Unfortunately, everything still works correctly. If it's a BusyBox shell
bug, the version I just tried (v1.1.3) doesn't have it.
On Mon, Aug 4, 2008 at 9:25 AM, Giuseppe Modugno
<g.modugno at elettronika.it>wrote:
> Dear all,
>
> I have two shell scripts, example.sh and flash.sh:
> ---
> root:/tmpfs/tmp> cat example.sh
> #!/bin/sh
>
> while true; do
> read X
> ./flash.sh &
> FLASHPID=$!
> sleep 5
> kill $FLASHPID
> done
> ---
> root:/tmpfs/tmp> cat flash.sh
> #!/bin/sh
>
> while true; do
> echo "ON"
> sleep 1
> echo "OFF"
> sleep 1
> done
> ---
> example.sh waits for an input from the keyboard and launches the
> second script flash.sh. After some seconds, example.sh kills the
> second script that it launched.
>
> Here what happens on my ARM system based on ELDK4.1 SELF ramdisk:
> ---
> root:/tmpfs/tmp> ./example.sh
>
> ON
> OFF
> ON
> OFF
> ON
> 736: Terminated
>
> Killed
> root:/tmpfs/tmp>
> ---
> This first blank line corresponds to the RET key press and correctly
> example.sh spawns flash.sh that writes ON/OFF. After 5 seconds,
> example.sh kills flash.sh process (I think the line "736: Terminated"
> is a kernel message on the console).
>
> The second blank line corresponds to the second RET key press, but in
> this case the main example.sh script dies without reason.
>
> What happens? I tried both the scripts in Ubuntu on my PC and they
> works as expected.
> _______________________________________________
> eldk mailing list
> eldk at lists.denx.de
> http://lists.denx.de/mailman/listinfo/eldk
>
--
Jeffrey Haemer <jeffrey.haemer at gmail.com>
720-837-8908 [cell]
http://goyishekop.blogspot.com
More information about the eldk
mailing list