[PATCH] Fixes for /etc/init.d/batmand

3 views
Skip to first unread message

Antoine van Gelder

unread,
Dec 22, 2009, 1:33:08 PM12/22/09
to village-...@googlegroups.com

As written, neither the 'stop' nor 'reload' functions of /etc/init.d/batmand work as expected.

Firstly, for OpenWRT init.d scripts we run into difficulties using $0 to refer to the script as it will expand to /etc/rc.common

Secondly, using 'killall batmand' has the problem that the init script is also called batmand. :)

- a


Signed-off-by: Antoine van Gelder <ant...@7degrees.co.za>
---
Index: potato/net/batman/files/etc/init.d/batmand
===================================================================
--- potato/net/batman/files/etc/init.d/batmand (revision 205)
+++ potato/net/batman/files/etc/init.d/batmand (working copy)
@@ -50,11 +50,12 @@
}

restart () {
- $0 stop
+ /etc/init.d/batmand stop
sleep 3
- $0 start
+ /etc/init.d/batmand start
}

stop () {
- killall batmand
+ BATPID=$(ps | grep batmand | cut -d ' ' -f 2 | head -1)
+ kill $BATPID
}

elektra

unread,
Dec 23, 2009, 11:37:13 AM12/23/09
to village-...@googlegroups.com
Hello Antoine -


> As written, neither the 'stop' nor 'reload' functions of
> /etc/init.d/batmand work as expected.
>
> Firstly, for OpenWRT init.d scripts we run into difficulties using $0 to
> refer to the script as it will expand to /etc/rc.common
>
> Secondly, using 'killall batmand' has the problem that the init script is
> also called batmand. :)

thanks, I'll include it with the next release. Will take a few days since I'll
take a few days off.

Have a nice time!

Cheers,
Elektra


>
> - a
>
>
> Signed-off-by: Antoine van Gelder <ant...@7degrees.co.za>
> ---
> Index: potato/net/batman/files/etc/init.d/batmand
> ===================================================================
> --- potato/net/batman/files/etc/init.d/batmand (revision 205)
> +++ potato/net/batman/files/etc/init.d/batmand (working copy)
> @@ -50,11 +50,12 @@
> }
>
> restart () {
> - $0 stop
> + /etc/init.d/batmand stop
> sleep 3
> - $0 start
> + /etc/init.d/batmand start
> }
>
> stop () {
> - killall batmand
> + BATPID=$(ps | grep batmand | cut -d ' ' -f 2 | head -1)
> + kill $BATPID
> }
>
>
>

> --
>
> You received this message because you are subscribed to the Google Groups
> "village-telco-dev" group. To post to this group, send email to
> village-...@googlegroups.com. To unsubscribe from this group, send
> email to village-telco-...@googlegroups.com. For more options,
> visit this group at
> http://groups.google.com/group/village-telco-dev?hl=en.
>

Reply all
Reply to author
Forward
0 new messages