run 1.2 KB

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