So I have configured my Thin Client Fujitsu Futro S740 with dietpi - nativePC as a home media server with sonarr/radarr/sabnzbd. Everything has the latest version
It’s probably a super dumb and simple question:
I want to configure dietpi, that it shutdown/sleep mode at a specific time (let’s say 00:00 midnight) and automatically boot back up in the morning at 08.00 am.
I am anyway sleeping at that time and it don’t want the server run during that time.
I use 1gbit lan wired connection. Here is the futro s740 hardware
If you want to save power…just get one of those programmable power plug timers[something like that, link is just an example]…just make sure you setup a cronjob to shutdown -h now before the timer cuts power to the box
If I remember correctly, thin clients have an option in the BIOS to automatically boot after the power is restored, so it would be useful for you to get to the BIOS somehow. For example, you don’t have a stationary PC that you could temporarily disconnect and connect the Fujitsu?
i will first go down the RTC Clock route and see if thats working. since for that i do not need to change anything with my setup (thin client and cable management is fixed and i would need to break up everything else at my home cinema to get the client out (inkl charging cable etc. - that would be a last resort solution… bad planning on my side. im fully responsible)
i checked now the RTC shutdown and Wake path and it works on my thin client!
I followed this guide and now i have a question for the following step:
you are ready to use this simple shutwake script to shutdown and start up your computer whenever you want:
#!/bin/bash
sh -c "echo 0 > /sys/class/rtc/rtc0/wakealarm"
sh -c "echo `date '+%s' -d '+ 420 minutes'` > /sys/class/rtc/rtc0/wakealarm"
shutdown -h now
It works like this: make it executable, put it in root’s path (like /usr/local/bin ), and create a root cron job to run it when you want your computer to shut down, like this example that runs the script at five minutes past midnight on weeknights:
# crontab -e
# m h dom mon dow command
05 00 * * 1-5 /usr/local/sbin/shutwake
The script will set the wakeup alarm at 420 minutes after shutdown at 12:05AM. This is a lot simpler than hassling with UTC and epoch time conversions, which is what you’ll see in other RTC wakeup howtos.
Question:
in step 2. i need to create a file and make it executable? How do i do that?
It works like this: make it executable, put it in root’s path (like /usr/local/bin )
is that the correct way to do it?:
cd /usr/local/bin
nano shutwake
and then copy paste following:
#!/bin/bash
sh -c "echo 0 > /sys/class/rtc/rtc0/wakealarm"
sh -c "echo `date '+%s' -d '+ 420 minutes'` > /sys/class/rtc/rtc0/wakealarm"
shutdown -h now
Press Control+x
how do i change the cronjob form step 2 and 3 that it runs not weekdays, but everyday. Is this correct?:
# crontab -e
# m h dom mon dow command
05 00 * * 1-7 /usr/local/sbin/shutwake
Normally in bin and sbin are just binaries and no script files. But it doesn’t matther, you can store it wherever you want (and wherever the user has permissions to execute it). But the path in the crontab should correspond to the path where it’s actually stored.
And you don’t need a file type, but you could give it .sh since it’s a bash script.
thanks! do you have a better location in dietpi for the .sh script? or should i use the provided one?
and changing the cronjob to run all days of the week is changed the range from 1-5 (like in the example) to 1-7?
(answered by the link @Joulinar provided. its 1-7)
root@DietPi:~# crontab -e -u root
no crontab for root - using an empty one
crontab: installing new crontab
"/tmp/crontab.VMFXJH/crontab":4: bad minute
errors in crontab file, can't install.
Do you want to retry the same edit? (y/n)
Got it. Family is using right now the server so I can’t tinker anymore now. Will see what happens tonight and if it doesn’t work I’m gonna try a shorter period tomorrow
the device would cut the power, if set to power up when power is applied, it would autostart
however I guess if there is a software option that would work better…but will the thinclient be using power just sitting idle, it’s not using that much power anyway?
Electrical values
Power consumption long idle 4.2 W
Power consumption sleep mode power 0.59 W (WoL enabled)
Power consumption off mode power 0.25 W (WoL disabled)
Power consumption note Consumption can differ depending on selected hardware, software and settings.