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

Logging to syslog from scheduled event

Discussion in 'Tomato Firmware' started by david3, Dec 18, 2009.

  1. david3

    david3 Addicted to LI Member

    I have a script running from the Scheduler under "Custom 1" in Tomato to do a ping test to my ISP gateway, and if it fails 3 times in a row, it will reboot the modem.

    I think it's working, but I'd like it to log its progress to syslog, so I can check on it. I've tried using the "logger" command, which works from the shell, but I get nothing when its run from the scheduler.

    logger MESSAGE
    or
    /usr/bin/logger MESSAGE

    (neither works)

    Does anybody know of a way I can log a message from a script running from the scheduler?

    I'm using Tomato v1.25.8515 .2RAF ND

    Thanks

    Here's the script I'm using so far.

    Code:
    if ping -c1 {gateway_ip}
    then
      logger Modem <OK>
    else
      logger Modem <No Response> [1]
      sleep 30
      if ping -c1 {gateway_ip}
      then
        logger Modem <OK> [2]
      else
        logger Modem <No Response> [2]
        sleep 30
        if ping -c1 {gateway_ip}
        then
          logger Modem <OK> [3]
        else
          logger Modem <No Response> [3] REBOOTING MODEM
          ( sleep 2; echo "{pass}"; sleep 2; echo "sys reboot"; sleep 2; ) | telnet 192.168.1.1
        fi
      fi
    fi
    
     
  2. david3

    david3 Addicted to LI Member

    I got it to work. I think it didn't like the <> characters in the message. Once I quoted it, like:

    logger "Modem <OK>"

    It worked.
     

Share This Page