help needed: execute script before disconnecting wan on idle / read current idle time

Discussion in 'Tomato Firmware' started by antiplex, Aug 14, 2011.

  1. antiplex

    antiplex Addicted to LI Member

    hello community,

    i've been browsing these forums pages for about 2 hours and found plenty of useful information but still my main questions remain unanswered:

    i am currently looking for a way to run a script which should trigger a web-request through wget right when the router is about to disconnect its pppoe wan connection because its been idle for the defined amount of time (basic -> network -> max idle time). i do not want to reset the idle-timecounter through this, so i guess i need to hook onto the script that disconnects after the idle limit has been reached.

    can anybody give me a hint where i might find such script/hook of if there is another (better) approach?

    i am currently running tomato-slodki-ND-1.28.02 on my linksys wrt54gl (sdmod performed jsut recently, veeery nice!)

  2. antiplex

    antiplex Addicted to LI Member

    hi again,

    i must confess i don't know enough about the structure of tomato but while looking for something that might give me a hint into the right direction i found that there seems a function get_idle_time in sys-linux.c that returns ioctl(ppp_dev_fd, PPPIOCGIDLE, ip) so i believe PPPIOCGIDLE seems to reflect the current idle time of the pppoe connection.
    i still have no idea where this is used or how i might access it but i realized that there is probably no easy solution for what i asked, especially since the idle timeout-handling seems to be encapsulated within the ppp device.
    still, any ideas?
  3. antiplex

    antiplex Addicted to LI Member

    hm, i still havent figured out how to achive the above :(
    anyway, i found that pppoecd comes with a disconnect callback parameter as it seems ([-C disconnected function], last parameter as described by bogderpirat posting
    has anybody tried this so far?
    to my understanding, i should not esablish a wan/ppp0-connection manually (by script) with pppoecd since tomato would try to do so automatically after idling when a web-request is detected. so i wonder where pppoecd is called from within tomato and if i could add a parameter to make use of that callback.
    maybe someone around here can provide me with an example how this could look like?

    cheers & TIA,

    edit: while taking a closer look on functions within the tomato-gui i just came across ooglek's interesting posting where he describes how to use 'nvram set action_service=<directive>' followed by a 'kill -USR1 1'. still not really what i was hoping for...*sigh*
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice