1 |
apollock |
29 |
#!/usr/bin/python |
2 |
|
|
|
3 |
|
|
# |
4 |
|
|
# Daemon to monitor /proc/diskstats and spin down USB drives determined to be |
5 |
|
|
# idle |
6 |
|
|
# |
7 |
|
|
# Author: Andrew Pollock <me@andrew.net.au> |
8 |
|
|
# Copyright: (c) 2008 Andrew Pollock <me@andrew.net.au> |
9 |
|
|
# |
10 |
|
|
|
11 |
|
|
# |
12 |
|
|
# Need a config file that contains the drives to watch and how long they must |
13 |
|
|
# be idle for before spinning down |
14 |
|
|
# |
15 |
|
|
# Need to determine if sg_start is installed, and if so, where |
16 |
|
|
# |
17 |
|
|
# Need to monitor field 13 of /proc/diskstats for each drive. Value unchanged |
18 |
|
|
# from last time means idle, value changed means not-idle and presumed spun-up |
19 |
|
|
# |
20 |
|
|
# Need to maintain a flag for when we've spun the drive down, so we don't keep |
21 |
|
|
# spinning it down every time we think it's idle |
22 |
|
|
# |
23 |
|
|
|
24 |
|
|
def main(): |
25 |
|
|
pass |
26 |
|
|
|
27 |
|
|
if __name__ == "__main__": |
28 |
|
|
main() |