run 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/sh
  2. #exec >/dev/null
  3. exec 2>&1
  4. exec </dev/null
  5. pwd="$PWD"
  6. if="${PWD##*/ifplugd_}"
  7. echo "* Starting ifplugd on $if [$$]"
  8. exec \
  9. env - PATH="$PATH" \
  10. softlimit \
  11. setuidgid root \
  12. ifplugd -apqns -t3 -u8 -d8 -i "$if" -r "$pwd/ifplugd_handler"
  13. # We use -t3 to wake ifplugd up less often.
  14. # If after three tests (3*3=9 > 8) link state seen to be different,
  15. # the handler will be called.
  16. # IOW: short link losses will be ignored, longer ones
  17. # will trigger DHCP reconfiguration and such (see handler code).
  18. #-a Do not up interface automatically
  19. #-p Dont run script on daemon startup
  20. #-q Dont run script on daemon quit
  21. #-n Do not daemonize
  22. #-s Do not log to syslog
  23. #-t SECS Poll time in seconds
  24. #-u SECS Delay before running script after link up
  25. #-d SECS Delay after link down
  26. #-i IFACE Interface
  27. #-r PROG Script to run
  28. #-f/-F Treat link detection error as link down/link up (otherwise exit on error)
  29. #-M Monitor creation/destruction of interface (otherwise it must exist)
  30. #-x ARG Extra argument for script
  31. #-I Dont exit on nonzero exit code from script
  32. #-l Run script on startup even if no cable is detected
  33. #-m MODE API mode (mii, priv, ethtool, wlan, auto)