pySleepWake

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.

Contribution

Is welcome and wanted!

Licensing

GNU Affero General Public License

Recent Commits to pySleepWake:master

Added another constraint to check if it is time to go to sleep, the load average. (sleep.py).
Author: ldemattos
Posted: September 24, 2017, 9:44 pm
Merge branch 'issue_#2'
Author: ldemattos
Posted: September 7, 2017, 3:24 pm
Small fixes in README.md
Author: ldemattos
Posted: September 7, 2017, 3:02 pm
Improving README.md
Author: ldemattos
Posted: September 7, 2017, 2:59 pm
small change in log output text formatting.
Author: ldemattos
Posted: September 7, 2017, 1:49 pm
Correction in delay (alarm.py).
Author: ldemattos
Posted: September 7, 2017, 1:10 pm
Few logic tweaking.
Author: ldemattos
Posted: September 7, 2017, 12:58 am
Minor adjustament.
Author: ldemattos
Posted: September 7, 2017, 12:47 am
Simplifying alarm.py
Author: ldemattos
Posted: September 6, 2017, 10:41 pm
Added time delay after waking up the server.
Author: ldemattos
Posted: September 6, 2017, 10:03 pm
Small simplification in alarm.py.
Author: ldemattos
Posted: September 6, 2017, 9:52 pm
Improvements:
	- Library path in both alarm.py and sleep.py;
	- Added systemd unit file for sleep (sleep.service);
	- Minor correctior in alarm.conf.template.
Author: ldemattos
Posted: September 3, 2017, 8:25 pm
Minor mistake in alarm.conf.template
Author: ldemattos
Posted: August 27, 2017, 12:45 am
Logs are pretty cool now. Prints are no more necessary.
Author: ldemattos
Posted: August 27, 2017, 12:43 am
Further improvements in logging.
Author: ldemattos
Posted: August 27, 2017, 12:40 am
Many improvements.
Author: ldemattos
Posted: August 27, 2017, 12:28 am
Dumb logic errro :P lol
Author: ldemattos
Posted: August 24, 2017, 3:42 pm
Small error.
Author: ldemattos
Posted: August 24, 2017, 3:36 pm
Printing to alarm.log the computer who is poking the server to wake up.
Author: ldemattos
Posted: August 24, 2017, 3:32 pm
Added log output for alarm.py .
Author: ldemattos
Posted: August 24, 2017, 1:15 am

Leave a Reply