Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Script: Power/Switch on server by schedule

Featured Replies

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

 

  • 1 year later...

hallo,auf was deuten die Zeiten hin?

On 12/3/2022 at 10:37 AM, mgutt said:
times=(
  20:00
  08:00

 

 

????

Is it possible to merge power off and power on commands to one script?

 

times= {

poweroff=20

poweron=8

}

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.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.