mgutt Posted December 3, 2022 Share Posted December 3, 2022 You need to enable RTC wake up in your BIOS. After that use the User Scripts Plugin to create a script and let it execute hourly. Script: #!/bin/bash # ##################################### # ######### Settings ################## # ##################################### times=( 20:00 08:00 ) # ##################################### # ######### Script #################### # ##################################### # sort times readarray -t times < <(for a in "${times[@]}"; do echo "$a"; done | sort) # delete wakealarm echo 0 > /sys/class/rtc/rtc0/wakealarm # loop through times for time in "${times[@]}"; do # obtain current and wakealarm timestamps now=$(date +%s) fut=$(date -d $time +%s) # does the wakealarm happen today? if [[ now -ge fut ]]; then fut='' continue fi # set wakealarm for today echo $fut > /sys/class/rtc/rtc0/wakealarm logger -t wakealarm "set wakealarm to "$(date -d "@$fut") exit done # set wakealarm for tomorrow if [[ -z $fut ]]; then fut=$(date -d "tomorrow ${times[0]}" +%s) echo $fut > /sys/class/rtc/rtc0/wakealarm logger -t wakealarm "set wakealarm to "$(date -d "@$fut") fi The poweroff should be done in a separate script after your task has been finished or maybe on a specific time by executing a separate script with a specific crontab schedule. That command is simple: shutdown Quote Link to comment
Apollo71 Posted March 9 Share Posted March 9 hallo,auf was deuten die Zeiten hin? On 12/3/2022 at 10:37 AM, mgutt said: times=( 20:00 08:00 Quote Link to comment
Vitek Posted March 19 Share Posted March 19 Is it possible to merge power off and power on commands to one script? times= { poweroff=20 poweron=8 } Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.