TubeArchivist, Part Five

TubeArchivist, Part Five
Photo by Minku Kang / Unsplash

Automate Server Reboots

I realized after a recent fileserver reboot that I need to have it also tell TUBEARCHIVIST-01 to reboot to help keep the mounts fresh.

Steps performed on FILESERVER

  • Created c:\Scripts\tubearchivist.ps1
# Command to reboot TUBEARCHIVIST-01
ssh -t -i c:\Users\Administrator.DOMAIN\.ssh\tubearchivist [email protected] "sudo reboot ; bash --login"
  • I save the file tubearchivist.ps1

I test the script and it is asking for the sudo password. Oh yeah I have to add that permission.

Steps performed on TUBEARCHIVIST-01

  • sudo nano /etc/sudoers
    • david ALL=NOPASSWD: /sbin/halt, /sbin/reboot, /sbin/poweroff

Steps performed on FILESERVER

Testing again from fileserver's tubearchivist.ps1 is a success now. So I create a scheduled task to have it run the script after the fileserver reboots. This puts my project in a great spot!