watchcat.lua 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. -- Copyright 2012 Christian Gagneraud <chris@techworks.ie>
  2. -- Licensed to the public under the Apache License 2.0.
  3. m = Map("system",
  4. translate("Watchcat"),
  5. translate("Watchcat allows configuring a periodic reboot when the " ..
  6. "Internet connection has been lost for a certain period of time."
  7. ))
  8. s = m:section(TypedSection, "watchcat")
  9. s.anonymous = true
  10. s.addremove = true
  11. mode = s:option(ListValue, "mode",
  12. translate("Operating mode"))
  13. mode.default = "allways"
  14. mode:value("ping", "Reboot on internet connection lost")
  15. mode:value("allways", "Periodic reboot")
  16. forcedelay = s:option(Value, "forcedelay",
  17. translate("Forced reboot delay"),
  18. translate("When rebooting the system, the watchcat will trigger a soft reboot. " ..
  19. "Entering a non zero value here will trigger a delayed hard reboot " ..
  20. "if the soft reboot fails. Enter a number of seconds to enable, " ..
  21. "use 0 to disable"))
  22. forcedelay.datatype = "uinteger"
  23. forcedelay.default = "0"
  24. period = s:option(Value, "period",
  25. translate("Period"),
  26. translate("In periodic mode, it defines the reboot period. " ..
  27. "In internet mode, it defines the longest period of " ..
  28. "time without internet access before a reboot is engaged." ..
  29. "Default unit is seconds, you can use the " ..
  30. "suffix 'm' for minutes, 'h' for hours or 'd' " ..
  31. "for days"))
  32. pinghost = s:option(Value, "pinghosts",
  33. translate("Ping host"),
  34. translate("Host address to ping"))
  35. pinghost.datatype = "host"
  36. pinghost.default = "8.8.8.8"
  37. pinghost:depends({mode="ping"})
  38. pingperiod = s:option(Value, "pingperiod",
  39. translate("Ping period"),
  40. translate("How often to check internet connection. " ..
  41. "Default unit is seconds, you can you use the " ..
  42. "suffix 'm' for minutes, 'h' for hours or 'd' " ..
  43. "for days"))
  44. pingperiod:depends({mode="ping"})
  45. return m