Re: Improve leafnode
Camaleón <noelamac@gmail.com> writes:
[...]
>> Ppp only triggers when a ppp* interface goes up.
>
> When there's a Internet connection (dial-up, ppp dsl, umts...) in place,
> right?
Right, the script /etc/ppp/ip-up.d/leafnode triggers when ppp0 is
established.
>> I'd like to make it more general.
>
> More general in what way, exactly? What kind of scenario do you have in
> mind? I ask because your suggestion (if found useful by the package
> maintainers) could be also added in the Debian package without needing to
> use to a sed script or something like that.
In few words: a system wide cronjob already, periodically (every hour),
tests if leafnode is configured in PPP or permanent mode. If PPP it skips
over, if permament fetchnews is launched. I set it as PPP because I
don't want my syslog flooded with error messages about missing
connection.
[1] /etc/cron.d/leafnode
--8<---------------cut here---------------start------------->8---
# Cron entries for Leafnode.
# Run /etc/news/leafnode/do-fetch-news every hour.
8 * * * * news if [ -x /etc/news/leafnode/do-fetch-news ]; then /etc/news/leafnode/do-fetch-news; fi
--8<---------------cut here---------------end--------------->8---
[2] /etc/news/leafnode/do-fetch-news
--8<---------------cut here---------------start------------->8---
# Get configuration
. /etc/news/leafnode/debian-config
...
# Get new news.
if [ "$NETWORK" = "permanent" -a -x /usr/sbin/fetchnews ]; then
/usr/sbin/fetchnews
fi
--8<---------------cut here---------------end--------------->8---
I think it could be smarter.
>> A solution I'm working on is a script which use sed to toggle $NETWORK
>> between PPP and permanent when the laptop is online, I only would like
>> to know how to run this script from inside interfaces
> I'm not sure if that would work as you expect given the way it is
> configured now because the service has been already started so in order
> to alter the $NETWORK variable you'll have to restart or reload the
> leafnode service every time that variable changes, is that what you
> want? :-?
No, but please note that $NETWORK variable is read every time that the
cronjob starts, at worst I will have a one hour lag.
> Anyway, you can take a look at the networking docs:
>
> Http://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_scripting_with_the_ifupdown_system
>
> Greetings,
Thanks.
--
- Cosa si deve fare per avere le mani sempre ben curate?
- Niente!
Reply to: