Automatic switch ON/OFF

Vortigern

Dabbler
Joined
Oct 14, 2022
Messages
45
Hi there,
I'm assembling a new microserver and would like to use Truenas. I will be using the server mostly for:
  • Plex: 1 client
  • Storage: 2 clients (probably via NFS)
Since I will be using the NAS at home I would like to have a way to make clean shutdown/sleep and if possible this to be automatic, e.g.:
  • Shutdown/Sleep
    • GOAL after X hours after the last file access request
    • ACCEPTABLE at a certain time of the day
    • other
  • Power on/Wake up
    • after a a WoL request
    • other
Instead of shutdown a sleep state would be totally fine or maybe even better: the basic idea is that the NAS becomes readily available when there's a request for a file or steam, etc. while it goes into sleep after being unused for a certain time. What I would also like to understand is:
  • concerns related to the sleep, e.g. make sure the NAS is not entering sleep mode before every write to the pool have been completed
  • way to wake up during sleep, e.g. what event could be used to wake up the NAS
EDIT
The two clients are PCs running Linux Mint (currently version 21) and I would like to mount the NFS at boot so a quick process to wake the NAS would be ideal so that I will not be waiting for the machine to boot.

Thanks a lot for you support,
Vortigern
 
Last edited:
Joined
Jun 2, 2019
Messages
591
1. Add a cron to shutdown at a prescribed time of day
2. Enable WOL in the BIOS and send WOL magic packets from another client when you want to power up.
3. Alternatively, you can set the BIOS power state to power back up and put the NAS on an Ethernet controlled power strip.
 

Vortigern

Dabbler
Joined
Oct 14, 2022
Messages
45
Dear @elvisimprsntr,
thanks a lot for your quick reply. I forgot to mention that I would like the NAS to wake when I'm booting my PCs (both running Linux MINT 21) so that I can mount the NFS at boot time (I will edit the first post to reflect this). So setting up a cron to shutdown at certain time of the day would be of no concern and acceptable, but on the other and I don't know if I can setup automatic WOL packet during the boot process of my PCs and this might probably be a long process. Would you instead recommend sleep instead?

Regards,
Vortigern
 
Joined
Jun 2, 2019
Messages
591
Easy. Since you are running linux, you can set up a cron on the client to run at boot

Simply create a bash script that executes the WOL command (make sure to add execute permissions to the script, i.e. chmod a+x) and add @Reboot to the crontab entry to automatically run at boot up

Code:
which bash # to find full path of bash shell or what ever shell you want to use
crontab -e # to edit contrab settings


Code:
@reboot /{pathname}/bash /{pathname}/{filename}
 
Last edited:
Joined
Jun 2, 2019
Messages
591
Top