version 2, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
UPSSCHED |
|
|
2 |
!!!UPSSCHED |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
NOTE |
|
|
6 |
DESCRIPTION |
|
|
7 |
INTEGRATION |
|
|
8 |
CONFIGURATION |
|
|
9 |
EARLY SHUTDOWNS |
|
|
10 |
DEBOUNCING EVENTS |
|
|
11 |
BACKGROUND |
|
|
12 |
FILES |
|
|
13 |
SEE ALSO |
|
|
14 |
---- |
|
|
15 |
!!NAME |
|
|
16 |
|
|
|
17 |
|
|
|
18 |
upssched - Timer helper for scheduling events from upsmon |
|
|
19 |
!!SYNOPSIS |
|
|
20 |
|
|
|
21 |
|
|
|
22 |
__upssched__ |
|
|
23 |
!!NOTE |
|
|
24 |
|
|
|
25 |
|
|
|
26 |
__upssched__ should be run from upsmon(8) via the |
|
|
27 |
NOTIFYCMD. You should never run it directly during normal |
|
|
28 |
operations. |
|
|
29 |
!!DESCRIPTION |
|
|
30 |
|
|
|
31 |
|
|
|
32 |
__upssched__ was created to allow users to execute |
|
|
33 |
programs at times relative to events being monitored by |
|
|
34 |
upsmon(8). The original purpose was to allow for a |
|
|
35 |
shutdown to occur after some fixed period on battery, but |
|
|
36 |
there are other uses that are possible. |
|
|
37 |
!!INTEGRATION |
|
|
38 |
|
|
|
39 |
|
|
|
40 |
upssched needs to be called as the NOTIFYCMD in your |
2 |
perry |
41 |
upsmon.conf(5). It determines what is happening based |
1 |
perry |
42 |
on the UPSNAME and NOTIFYTYPE environment variables. You |
|
|
43 |
should never have to deal with them directly. |
|
|
44 |
|
|
|
45 |
|
|
|
46 |
Set the EXEC flag on the events that you want to see in |
|
|
47 |
upssched. For example, to make sure that upssched hears |
|
|
48 |
about ONLINE, ONBATT and LOWBATT events, the flags would |
|
|
49 |
look like this: |
|
|
50 |
|
|
|
51 |
|
|
|
52 |
NOTIFYFLAG ONLINE EXEC |
|
|
53 |
NOTIFYFLAG ONBATT EXEC |
|
|
54 |
NOTIFYFLAG LOWBATT EXEC |
|
|
55 |
|
|
|
56 |
|
|
|
57 |
If you also want to continue writing to the syslog, just add |
|
|
58 |
it in: |
|
|
59 |
|
|
|
60 |
|
|
|
61 |
NOTIFYFLAG ONLINE SYSLOG+EXEC |
|
|
62 |
NOTIFYFLAG ONBATT SYSLOG+EXEC |
|
|
63 |
NOTIFYFLAG LOWBATT SYSLOG+EXEC |
|
|
64 |
|
|
|
65 |
|
|
|
66 |
For a full list of notify flags, see the upsmon(8) |
|
|
67 |
documentation. |
|
|
68 |
!!CONFIGURATION |
|
|
69 |
|
|
|
70 |
|
2 |
perry |
71 |
See upssched.conf(5) for information on configuring |
1 |
perry |
72 |
this program. |
|
|
73 |
!!EARLY SHUTDOWNS |
|
|
74 |
|
|
|
75 |
|
|
|
76 |
To shut down the system early, define a timer that starts |
|
|
77 |
due to an ONBATT condition. When it triggers, make your |
|
|
78 |
CMDSCRIPT call your shutdown routine. It should finish by |
|
|
79 |
calling |
|
|
80 |
|
|
|
81 |
|
|
|
82 |
Be sure you cancel the timer if power returns |
|
|
83 |
(ONLINE). |
|
|
84 |
!!DEBOUNCING EVENTS |
|
|
85 |
|
|
|
86 |
|
|
|
87 |
If your UPS goes on and off battery frequently, you can use |
|
|
88 |
this program to reduce the number of pager messages that are |
|
|
89 |
sent out. Rather than sending pages directly from |
|
|
90 |
upsmon(8), use a short timer here. If the timer |
|
|
91 |
triggers with the UPS still on battery, then send the page. |
|
|
92 |
If the power returns before then, the timer can be cancelled |
|
|
93 |
and no page is necessary. |
|
|
94 |
!!BACKGROUND |
|
|
95 |
|
|
|
96 |
|
|
|
97 |
This program was written primarily to fulfill the requests |
|
|
98 |
of users for the early shutdown scenario. The |
|
|
99 |
|
|
|
100 |
|
|
|
101 |
This program was created separately so those people don't |
|
|
102 |
have to spend CPU time and RAM on something that will never |
|
|
103 |
be used in their environments. |
|
|
104 |
|
|
|
105 |
|
|
|
106 |
The design of the timer handler is also geared towards |
|
|
107 |
minimizing impact. It will come and go from the process list |
|
|
108 |
as necessary. When a new timer is started, a process will be |
|
|
109 |
forked to actually watch the clock and eventually start the |
|
|
110 |
CMDSCRIPT. When a timer triggers, it is removed from the |
|
|
111 |
queue. Cancelling a timer will also remove it from the |
|
|
112 |
queue. When no timers are present in the queue, the |
|
|
113 |
background process exits. |
|
|
114 |
|
|
|
115 |
|
|
|
116 |
This means that you will only see upssched running when one |
|
|
117 |
of two things is happening: |
|
|
118 |
|
|
|
119 |
|
|
|
120 |
- There's a timer of some sort currently |
|
|
121 |
running |
|
|
122 |
|
|
|
123 |
|
|
|
124 |
- upsmon just called it, and you managed to catch the brief |
|
|
125 |
instance |
|
|
126 |
|
|
|
127 |
|
|
|
128 |
The final optimization handles the possibility of trying to |
|
|
129 |
cancel a timer when there are none running. If the timer |
|
|
130 |
daemon isn't running, there are no timers to cancel, and |
|
|
131 |
furthermore there is no need to start a clock-watcher. So, |
|
|
132 |
it skips that step and exits sooner. |
|
|
133 |
!!FILES |
|
|
134 |
|
|
|
135 |
|
2 |
perry |
136 |
upssched.conf(5) |
1 |
perry |
137 |
!!SEE ALSO |
|
|
138 |
|
|
|
139 |
|
|
|
140 |
upsmon(8) |
|
|
141 |
|
|
|
142 |
|
|
|
143 |
__Internet resources:__ |
|
|
144 |
|
|
|
145 |
|
|
|
146 |
The NUT (Network UPS Tools) home page: |
|
|
147 |
http://www.exploits.org/nut/ |
|
|
148 |
|
|
|
149 |
|
|
|
150 |
NUT mailing list archives and information: |
|
|
151 |
http://lists.exploits.org/ |
|
|
152 |
---- |