1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Run Script after Router Initialzation Comlete (Shibby)

Discussion in 'Tomato Firmware' started by JB0909, Nov 4, 2013.

  1. JB0909

    JB0909 Reformed Router Member


    I want to run a script after my router has completely booted up. The script SSH's into another machine and is timing out if I run the script from the WANUP custom script section. Is is it possible to have the script run after the router has completely initialized (I believe this is after the wireless turns on) or run the script in the background from the WANUP section (avoiding the timeout)? Thanks for your help!

    n66u running shibby v114
  2. rs232

    rs232 Network Guru Member

    add a
    sleep x 
    before the script (where x is the number of seconds the router is asked to wait before running the next command)

  3. JB0909

    JB0909 Reformed Router Member

    The problem with that is that the code placed in WANUP has a timeout feature that would terminate any running code (in this case 'sleep') before it had a chance to run my script
  4. leandroong

    leandroong Addicted to LI Member

    this is what i use as script delay mode, enter it in script init
    darkknight93 likes this.
  5. JB0909

    JB0909 Reformed Router Member

    Thanks! I will give this a try.
  6. JB0909

    JB0909 Reformed Router Member

    I still seem to be having an issue. When I mannually run the script from the command line, everything works fine. However when the script is called from the INIT or WANUP section, it seems to only authenticate into the remote machine before the script is terminated. The command being executed in the remote machine takes about 30 seconds to complete (which I believe is causing the issue, timeout?). Here is the script I am using:
    sshout=`ssh -p 222 -i /opt/pia/269L_key.db -y admin@ "/share/HDA_DATA/.qpkg/Transmission/transmission.sh restart" 2>&1`
    RESULT=`echo $sshout | awk '{print $NF}'`
    logger "trRestart.sh[3]: Restart of tranmission-daemon on NAS-269L $RESULT"
    if [ "$RESULT" = "succeeded" ]; then
      exit 0
      exit 1
    Any help you could provide would be greatly appreciated!!
    Last edited: Nov 6, 2013

Share This Page