Søndag 24 oktober 2004 10:02 kvad Leendert Meyer:
On Sunday 24 October 2004 08:27, Johnny Ernst Nielsen wrote:
Lørdag 23 oktober 2004 16:54 kvad Leendert Meyer:
On Saturday 23 October 2004 15:40, Johnny Ernst Nielsen wrote:
Good day,
SUSE 9.0
Is there a place where I can put a script to be executed whenever any interface connects to the internet?
Like /etc/ppp/ip-up.d/ is the place for ppp0 connections, only somewhere that works for both eth0 and ppp0 (and possibly for other interfaces).
I have tried fumbeling with /etc/sysconfig/network/if-up.d/, but that does not work for ppp0 I have tried making /etc/sysconfig/network/ip-up.d/ (not iF-up) and putting a script there, but then nothing happens for any interface.
The scripts need to be executable: chmod +x some_script
They are:
me@mycomputer:~> ls -l /etc/sysconfig/network/ip-up.d/ totalt 4 -rwxr-xr-x 1 root root 88 2004-10-24 08:13 script.sh me@mycomputer:~>
The script looks like this:
#!/bin/bash echo "/etc/sysconfig/network/ip-up.d/script.sh called" >> /tmp/ ipuptest.txt #End of script
/tmp/ipuptest.txt is never created
The script does what it says when run manually by root.
Do I need to do anything else except putting an executable script in / etc/sysconfig/network/ip-up.d/ ? Any variables that needs to be set? Any files that needs to edited?
The commands
grep 'ip-up.d' {,/usr}/{,s}bin/*
and
grep -r 'ip-up.d' /etc/sysconfig/network
return nothing. Weird.
Not really, since that .../ip-up.d/ is one I created myself. I read in /usr/share/doc/packages/dhcpd/dhcpd-hook.example: "# NOTE: This is an older example of a dhcpcd hook script. # There is now a general hook script that should be used instead. # You can put additional scripts, that should be run, in # /etc/sysconfig/network/ip-up.d or configure a POST_UP_SCRIPT in the # ifcfg-<interface> files. See the comments in # /etc/sysconfig/network/scripts/dhcpcd-hook # for more information." In the mentioned file dhcpcd-hook it says that one of the things the script do is: "# - execute /etc/sysconfig/network/ip-{up,down}.d/* # (where you can place your own scripts)" The mentioned .../ip-ip.d/ did not exist, so I created it and put a script there. I have not tried configuring a POST_UP_SCRIPT in the ifcfg-<interface> files since that defies my goal of not having to make specifications for each interface, and just have it work for any interface.
Seems /etc/ppp/ip-(up,down}.d is only used by /etc/ppp/ip-up.
Try putting the scripts in /etc/sysconfig/network/if-(up,down}.d
That does not work for ppp0 -- probably does not work for any ppp interface. Thank you for your effort till now. Any other ideas? Best regards Johnny :o)