Results 1 to 3 of 3

Thread: How to run a script when pppd connects/disconnects

  1. #1

    How to run a script when pppd connects/disconnects

    I would like to run a script when pppd connects/disconnects. In Ubuntu, it is simple: I just add the script to /etc/ppp/ip-up.d and /etc/ppp/ip-down.d folders. In the koppel's mod of Oleg firmware, I just add the ip-up and ip-down scripts in /tmp/ppp folder.

    But this does not work in The ip-up and ip-down are symlinked to /sbin/rc. If I replace this ip-up with my ip-up, I get problems. It seems the builtin ip-up populates resolv.conf with the dns servers of my connection. I can get around this by hardcoding the dns servers. But I would rather not do it in this kludgy manner. Besides, I dont know what else does the /sbin/rc program do.

    I have tried the Ubuntu way with ip-up.d folder, but it is ignored. I searched through the posts and found one which suggested adding the ip-up to /tmp/etc/ppp folder; but this does not work as the script is ignored.

    Is there anyway to execute scripts on pppd connection/disconnection?


  2. #2
    Okay, I have been playing around with this. It seems that the ip-up and ip-down are symlinked to a binary which does all the work. I decided to replace these links to my up/down scripts. Basically, I duplicated how Ubuntu does it (Ubuntu uses ip-up.d and ip-down.d directories to contain the scripts to run and a master ip-up and ip-down scripts as the entry point from pppd).

    I used the ip-up and ip-down scripts from Ubuntu and edited them as I did not need as some of things. For ip-up.d folder, at least make a script to set /tmp/resolv.conf and sync datetime. I added these new files/directories to flash, rebooted and voila, it worked

    If someone is interested, I can post more details here.

  3. #3
    Ok, the above method required a lot of tweaking to cover for the functions carried out by the "rc" utility. I got tired of trying to mimic its functionality. So I decided to modify the sources to call another script when ppp connects/disconnects. I called these scripts ip-up.local and ip-down.local. These get called after rc has done all the work, the usual parameters for ip-up/ip-down get passed to the scripts and I can add my commands to these .local files. Works great

    I think it is a really useful feature and would like to submit a patch to whoever is maintaining the firmware (its not much of a patch actually, just 2 lines). Can someone guide me in the right direction here?


Similar Threads

  1. Run script after login ?
    By ffrr in forum WL-500gP Q&A
    Replies: 3
    Last Post: 21-03-2010, 08:31
  2. Pppoe doesn't work on Oleg fw
    By mandgeo in forum WL-500gP Firmware Discussion
    Replies: 7
    Last Post: 18-01-2009, 16:04

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts