blob: c4f766e8801aae1f5cd52486808dd72354da52cd [file] [log] [blame]
Denys Vlasenko6cf7f012009-11-06 04:04:19 +01001#!/bin/sh
2
Denys Vlasenko002bdc32009-11-09 11:04:54 +01003#exec >/dev/null
Denys Vlasenko6cf7f012009-11-06 04:04:19 +01004exec 2>&1
5exec </dev/null
6
7pwd="$PWD"
8
9if="${PWD##*/ifplugd_}"
10
Denys Vlasenko4f8ecf22015-10-24 14:55:33 +020011echo "* Upping iface $if"
12ip link set dev "$if" up
13
Denys Vlasenkobf40f562009-11-07 17:54:44 +010014echo "* Starting ifplugd on $if [$$]"
Denys Vlasenko6cf7f012009-11-06 04:04:19 +010015exec \
16env - PATH="$PATH" \
17softlimit \
18setuidgid root \
Denys Vlasenko002bdc32009-11-09 11:04:54 +010019ifplugd -apqns -t3 -u8 -d8 -i "$if" -r "$pwd/ifplugd_handler"
Denys Vlasenko6cf7f012009-11-06 04:04:19 +010020
Denys Vlasenko002bdc32009-11-09 11:04:54 +010021# We use -t3 to wake ifplugd up less often.
22# If after three tests (3*3=9 > 8) link state seen to be different,
23# the handler will be called.
24# IOW: short link losses will be ignored, longer ones
25# will trigger DHCP reconfiguration and such (see handler code).
Denys Vlasenkobf40f562009-11-07 17:54:44 +010026
Denys Vlasenko6cf7f012009-11-06 04:04:19 +010027#-a Do not up interface automatically
Denys Vlasenko6cf7f012009-11-06 04:04:19 +010028#-p Dont run script on daemon startup
29#-q Dont run script on daemon quit
Denys Vlasenkobf40f562009-11-07 17:54:44 +010030#-n Do not daemonize
31#-s Do not log to syslog
Denys Vlasenko6cf7f012009-11-06 04:04:19 +010032#-t SECS Poll time in seconds
33#-u SECS Delay before running script after link up
34#-d SECS Delay after link down
Denys Vlasenkobf40f562009-11-07 17:54:44 +010035#-i IFACE Interface
36#-r PROG Script to run
37#-f/-F Treat link detection error as link down/link up (otherwise exit on error)
38#-M Monitor creation/destruction of interface (otherwise it must exist)
39#-x ARG Extra argument for script
40#-I Dont exit on nonzero exit code from script
41#-l Run script on startup even if no cable is detected
Denys Vlasenko6cf7f012009-11-06 04:04:19 +010042#-m MODE API mode (mii, priv, ethtool, wlan, auto)