[qnut] fixed main window show/hide on tray icon click event
[nut.git] / nuts / dispatch
blob4063290be4b5a57fe18d461f1ddc446ae343f97a
1 #!/bin/bash
3 # /etc/nuts/dispatch
5 # Author: Stefan Bühler <stbuehler@web.de>, (C) 2007
6 # for Network UTility (nut).
8 # Executes scripts for events on devices.
9 # scripts should be located in /etc/nuts/events/<devname>/<event>.<priority><appname>
10 # if the directory <devname> does not exist, default is tried instead.
11 # scripts in /etc/nuts/events/all/<event>.<priority><appname> are executed for every device.
13 # Params: <event> <devicename> [<environmentname> [<ifindex>]]
15 # Environment:
16 # NUT_EVENT (event)
17 # NUT_DEVICE (device name)
18 # NUT_HAS_WLAN
19 # NUT_ESSID
21 # on state changes (=NUT_NEW_STATE): deactivated, activated, carrier, unconfigured, up
22 # NUT_ENVIRONMENT (env name)
23 # NUT_ENVIRONMENT_INDEX (env index)
24 # NUT_OLD_STATE ( last state)
25 # NUT_NEW_STATE = NUT_STATE ( current state)
27 # + on ifup/ifdown
28 # NUT_IP
29 # NUT_NETMASK
30 # NUT_LOCALDOMAIN
31 # NUT_STATUS ( off, static, dhcp, zeroconf )
32 # NUT_GATEWAY
33 # NUT_DNSSERVER (comma separated)
35 [ ! -d /etc/nuts/events ] && exit 0
37 cd /etc/nuts/events
39 if [ -d "$NUT_DEVICE" ]; then
40 run-parts --regex="^${NUT_EVENT}." "$NUT_DEVICE"
41 elif [ -d "default" ]; then
42 run-parts --regex="^${NUT_EVENT}." default
45 if [ -d "all" ]; then
46 run-parts --regex="^${NUT_EVENT}." all