Re: How-to auto-start programmes when I connect to Internet?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hal Burgiss wrote:

On Fri, Feb 13, 2004 at 02:01:04PM +0000, Coume - Lubox.com wrote:


Sure, write a script that checks for connection, and restarts whatever
you want it to.


Could you explain a bit more? Because I do not know how to do what
you told me... :(


Guys - I think you are missing an easier solution.
Correct me if I am wrong, but I think the problem you are solving is this:
There is an ethernet connection to an ISP, and all you want to do is run a script to restart services whenever that interface is brought up.


If that is the case just make a script /sbin/ifup-local that checks whether the sole argument is the interface you care about, and if so, performs the restarts.

Actually I like to put the ifup-local script in /etc/sysconfig/network-scripts and add a symbolic link to it from /sbin/ifup-local. That way I can keep my script in the same location as the interface configurations.


Here is a sample script I used to set system time whenever an on-demand ppp0 interface was started:
---------------------------------------------------------------
#!/bin/bash
#Invoked from ifup-post via /sbin/ifup-local ${DEVICE}
#The installer must add a symbolic link from /sbin/ifup-local to this script
if [ $1 = "ppp0" ] ; then
ntpdate=`ntpdate tock.usno.navy.mil 2>&1`
ntprc=$?
logger "ifup-local: $ntpdate"
if [ $ntprc -eq 0 ] ; then
clock -w
logger "ifup-local: clock -w performed"
fi
fi
---------------------------------------------------------------


--
-----------------------------------------------------------
  "Spend less!  Do more!  Go Open Source..." -- Dirigo.net
  Chris Johnson, RHCE #807000448202021





[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux