pySleepWake is a set of two small Python scripts that manages the process of suspending and waking up computers.
The script sleep.py is the one in charge of suspending the computer based on the average network traffic in a given time window. On the other hand, the script alarm.py is the one responsible for waking up the suspended computer through network when some other device is looking for it.
In conf/ directory there are cofiguration file samples for both alarm.py and sleep.py.
In systemd/ directory there are configurations samples for GNU/Linux systemd startup unit files.
All the scripts must be executed as root, since they perform administrative tasks such as suspending and executing etherwake.
The log files are by default stored in /var/log, however this behavior can be changed in the configurations files.
This project was developed with a domestic NAS (Network Attached Storage) in mind, since its usage rate do not requires a computer operating 24h/7, neither the power dispensed, the heat and/or the noise. A on demand approach seems a much better in that case.
Both scripts were designed and tested in GNU/Linux. I suppose that with minimum effort it should be portable through all Unix-flavors.
Is welcome and wanted!
Recent Commits to pySleepWake:master
Added another constraint to check if it is time to go to sleep, the load average. (sleep.py).
Merge branch 'issue_#2'
Small fixes in README.md
small change in log output text formatting.
Correction in delay (alarm.py).
Few logic tweaking.
Added time delay after waking up the server.
Small simplification in alarm.py.
Improvements: - Library path in both alarm.py and sleep.py; - Added systemd unit file for sleep (sleep.service); - Minor correctior in alarm.conf.template.
Minor mistake in alarm.conf.template
Logs are pretty cool now. Prints are no more necessary.
Further improvements in logging.
Dumb logic errro :P lol
Printing to alarm.log the computer who is poking the server to wake up.
Added log output for alarm.py .