Wer ein NAS unter Debian betreibt könnte sich dafür interessieren. rtcwake-schedule ist ein C++ scheduling Programm das komplexe Zeitpläne planen und nach Bedarf anpassen kann. Es nutzt zum Strom sparen rtcwake, falls das nicht funktioniert, klappt auch rtcwake-schedule nicht.
Das Readme auf github beschreibt auch sehr viel.
Es gibt eine man page welche nach man(1) installiert wird:
Download, build und install:
Code: Alles auswählen
git clone https://github.com/schorsch1976/rtcwake-schedule.git
cd rtcwake-schedule
mkdir build
cd build
cmake ..
make -j2
sudo make install
Test Build hat geschrieben: georg@M4700-vm:~/Dokumente/Entwicklung$ git clone https://github.com/schorsch1976/rtcwake-schedule.git
Klone nach 'rtcwake-schedule' ...
remote: Enumerating objects: 125, done.
remote: Counting objects: 100% (125/125), done.
remote: Compressing objects: 100% (52/52), done.
remote: Total 125 (delta 72), reused 120 (delta 68), pack-reused 0
Empfange Objekte: 100% (125/125), 36.69 KiB | 417.00 KiB/s, Fertig.
Löse Unterschiede auf: 100% (72/72), Fertig.
georg@M4700-vm:~/Dokumente/Entwicklung$ cd rtcwake-schedule
georg@M4700-vm:~/Dokumente/Entwicklung/rtcwake-schedule$ mkdir build
georg@M4700-vm:~/Dokumente/Entwicklung/rtcwake-schedule$ cd build
georg@M4700-vm:~/Dokumente/Entwicklung/rtcwake-schedule/build$ cmake ..
-- The C compiler identification is GNU 8.2.0
-- The CXX compiler identification is GNU 8.2.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: /usr/bin/git (found version "2.20.1")
Git: /usr/bin/git
-- Boost version: 1.67.0
-- Found the following Boost libraries:
-- date_time
-- system
-- Configuring done
-- Generating done
-- Build files have been written to: /home/georg/Dokumente/Entwicklung/rtcwake-schedule/build
georg@M4700-vm:~/Dokumente/Entwicklung/rtcwake-schedule/build$ make -j2
Scanning dependencies of target rtcwake-schedule
Scanning dependencies of target man
[ 50%] Building CXX object src/CMakeFiles/rtcwake-schedule.dir/main.cpp.o
[ 50%] Built target man
[100%] Linking CXX executable rtcwake-schedule
[100%] Built target rtcwake-schedule
georg@M4700-vm:~/Dokumente/Entwicklung/rtcwake-schedule/build$ sudo make install
[ 0%] Built target man
[100%] Built target rtcwake-schedule
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/man/man1/rtcwake-schedule.1.gz
-- Installing: /usr/local/bin/rtcwake-schedule
georg@M4700-vm:~/Dokumente/Entwicklung/rtcwake-schedule/build$ sudo make install
[ 0%] Built target man
[100%] Built target rtcwake-schedule
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/man/man1/rtcwake-schedule.1.gz
-- Up-to-date: /usr/local/bin/rtcwake-schedule
georg@M4700-vm:~/Dokumente/Entwicklung/rtcwake-schedule/build$
man page hat geschrieben: rtcwake-schedule(1) General Commands Manual rtcwake-schedule(1)
NAME
rtcwake-schedule - use rtcwake based on a complex schedule
SYNOPSIS
rtcwake-schedule [-h] [--help] [-t] [--test] [-f] [--force]
DESCRIPTION
rtcwake-schedule is designed to schedule the power up state of the ma‐
chine on a weekly basis.
rtcwake-scheduke compiles and runs on linux, freebsd and windows as it
is plain c++11, but on freebsd there is no known rtcwake program that
could be used to program the rtc for wakeup. If there exists one,
please email it to the author.
OPTIONS
-h, --help
Print the help and licence information.
-f, --force
Force the shutdown and set the next wake up time to the rtc. Over‐
rides the CheckStayAwake result.
-t, --test
Test the configuration. Be verbose abouts its state. Does not exe‐
cute the PowerDown script.
FILES
/etc/rtcwake-schedule/schedule
This files configures the schedule. It is a human readable file.
CONFIGURATION FILE
Example file with description
- Everything after # are comments
- Empty lines are ignored
Day syntax
- Mon Monday
- Tue Tuesday
- Wed Wednesday
- Thu Thuesday
- Fri Friday
- Sat Saturday
- Sun Sunday
Example schedule
# The specified times are the power on times.
# example:
Mon:16:00-Tue:01:00
Tue:16:00-Wed:01:00
Wed:10:35-Thu:01:00 # we can add comments afterwards
Thu:16:00-Fri:01:00
Fri:16:00-Sat:01:00
Sat:16:00-Sun:01:00
Sun:16:00-Mon:01:00
Check stay awake
When the machine is still up and it is in the off time of the schedule,
it checks the CheckStayAwake=... script. This script could use whatever
it needs to check if the machine should stay still awake. The authors
NAS, checks for open connections using netstat and checks logged in
users. This script prints a number of reasons to stay awake. In fact
the program interprets every other output than "0" as a reason to stay
awake.
Always shut down at the specified time
# Check Stay awake
# An output of <> "0", not ret_val, output on stdout, let it stay awake
# here the machine always stay awake
CheckStayAwake=echo 0
Check for open connections before shutting down
# Check Stay awake
# An output of <> "0", not ret_val, output on stdout, let it stay awake
# here the machine always stay awake
CheckStayAwake=netstat | grep tcp | wc -l
PowerDown
This command gets executed with %d replaced with the seconds needed to
wait to the next wake up time.
# Power down to off state
PowerDown=/usr/sbin/rtcwake -m off -s %d
AUTHOR
Georg Gast <georg@schorsch-tech.de>
SEE ALSO
netstat (8), rtcwake (8), grep (1), wc (1)
BUGS
Please report bugs at
https://github.com/schorsch1976/rtcwake-schedule/issues
version 0.3 19 Feb 2019 rtcwake-schedule(1)
Alternativ zur Installation können die Binaries direkt nach dem make src/ ausgeführt werden. (./src/rtcwake-schedule --help)
[1] https://github.com/schorsch1976/rtcwake-schedule