I tried having it recall itself as follows but it is still getting
killed now after 9 seconds.

updated script
<-------start of /etc/NetworkManager/dispatcher.d/99-test script
#!/bin/bash
test()
{
 x=0
 while [ ${x} -lt 25 ];do
 sleep 1
 echo ${x} > /tmp/test
 let x=${x}+1
 done
}
if [ "$1" = "test" ];then
 test
else
 exec /bin/bash -c "$0 test" &
fi
<------end of script

On Mon, Jul 29, 2013 at 10:51 PM, Dan Williams <d...@redhat.com> wrote:
> On Mon, 2013-07-29 at 22:35 -0600, Jeff Sadowski wrote:
>> Is there any way to have it launch maybe another script that can take
>> as long as it needs?
>> I thought putting the script in the background would allow it to run
>> till finished but it is still getting killed.
>
> You might be able to get around it if you exec a second script; the
> dispatcher only kills the PID that it originally spawned.
>
> Dan
>
>> On Mon, Jul 29, 2013 at 10:21 PM, Dan Williams <d...@redhat.com> wrote:
>> > On Mon, 2013-07-29 at 09:35 -0600, Jeff Sadowski wrote:
>> >> I created a simple script to show my problem.
>> >> <-------start of /etc/NetworkManager/dispatcher.d/99-test script
>> >> test()
>> >> {
>> >> x=0
>> >> while [ ${x} -lt 25 ];do
>> >> sleep 1
>> >> echo ${x} > /tmp/test
>> >> let x=${x}+1
>> >> done
>> >> }
>> >> test &
>> >> <------end of script
>> >>
>> >> the script gets killed after 8 seconds ie:
>> >> >cat /tmp/test
>> >> 8
>> >> >
>> >>
>> >> I don't see any error messages in /var/log/message pertaining to it.
>> >>
>> >> Is there a way to get my script to not get killed?
>> >> Maybe a way to externally call my script using dispatcher?
>> >
>> > Scripts actually get 3 seconds to complete.  They aren't currently
>> > expected to run for long, especially on network disconnection, because
>> > the network is already gone.  You can run the dispatcher with debug mode
>> > like:
>> >
>> > /usr/libexec/nm-dispatcher.action --debug --persist
>> >
>> > The daemon currently doesn't block waiting on scripts, but there have
>> > been discussions to make it do so.  Which would make this problem even
>> > more acute, since network changes could block on long-running scripts.
>> >
>> > Dan
>> >
>
>
_______________________________________________
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list

Reply via email to