Looking for a script to power on server, replicate, when finished shutdown?

junior466

Explorer
Joined
Mar 26, 2018
Messages
79
I found so many different topics on the subject with a few folks getting really close to achieving this goal. I have a backup server running TrueNAS simply for replication and I am looking for a script that would power on my backup server, start the replication (on the main server) and monitor for completion and when done, power it down. I am running Dell servers so I know that waking them up is no hard task but no idea where to go from there.

Thank you.
 

Arwen

MVP
Joined
May 17, 2014
Messages
3,611
It is more complicated that you think. Here are some of the gotchas;
  • You have to check if the backup server is already powered on.
  • After sending the power on command, (either WOL or IPMI), you have to wait until server is both booted and all the services are available
  • A check if the backup script is already running, (it could be taking days or weeks for unknown reasons).
  • You would have to check the network connection speed. If the backup server is used rarely, a wire or pin may fail in the cable route, thus ending up with 10/100Mega-bits per second instead of Gigabit speeds. (Assuming you are using copper 10/100/1000Mbps Ethernet.) If you don't check, you could find backups running forever and not know why.
  • Another script, or pre/post task would be needed to see if your backup server needs to run a scrub or SMART tests. If so, run those tests.
In essence, you have to manually manage a few things that a primary / always on NAS server does for you.


I was reminded of this because I am updating my old laptop, (it uses ZFS for both OS and other storage). Before the update, I made sure the 2 pool scrubs finished so that the disk I/O was not going to slow down the update. (I only update this laptop about once a month, so each time it needs to run a scrub.)
 
Top