Running stuff when a network becomes available

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Running stuff when a network becomes available

Ipsen S Ripsbusker-2
I want a few things to happen as soon as I get an internet connection
after not having had one. For example, if I am offline during a long bus
trip with a 40-minute transfer but I manage to find a coffee shop
with internet access during the transfer, I want to run the things
the moment I get access in the coffee shop.

I want to run things like these.

* Send emails that I have queued for sending.
* Receive new emails.
* Synchronize fossil repositories
* Synchronize git repositories

It would suffice to add a crontab entry that runs the attachment
periodically. But I request commentary on the following.

1. Is there already a better way to do this?
2. Is there a better way to determine whether I have just established
   a connection?

With great humility,
Ipsen

on-connect (368 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Running stuff when a network becomes available

Janne Johansson-3
Den mån 11 mars 2019 kl 14:11 skrev Ipsen S Ripsbusker
<[hidden email]>:
>
> I want a few things to happen as soon as I get an internet connection
> after not having had one.
> It would suffice to add a crontab entry that runs the attachment
> periodically.

ifstated(8) can be taught to watch over an interface and run whatever
scripts you like
when some interface comes up, so as long as you can run all mail
sending operations
and the like from a script, you should be done real quickly.

--
May the most significant bit of your life be positive.