I know this answer comes a bit later:
So I did the same for the same reasons, not sure if this is the best way to achieve this, but he solved many of our problems:
For Windows machines:
- Create a task that simply runs shutdown -r -f on Windows machines. He will restart the machine.
- Now return the online part. For the same reasons as you, I did not use jenkins-slave as a service. Instead, I configured the nodes to connect through the JNLP client, and then added slave.jar commands for each node in the Windows task scheduler (to start the launch)
- Now the task restarts the machine and the Windows computer itself on the Internet on Jenkins immediately after rebooting.
For Mac computers:
This was part of the "run the shell" of my script to reboot all the machines used for our automation:
distro=`uname` if [ "$distro" = "Windows_NT" ] || [ "$distro" = "WindowsNT" ] ;then echo "Restarting Windows Machine...." shutdown -r -f else echo "Restarting Mac Machine...." sudo shutdown -r now fi
PS:
This is not entirely related to the question, but may be useful for the situation you have indicated. It might be a good idea to add a batch script package to clean temp files when starting Windows machines. Add the following folder to the batch script folder (say, cleanTemp.bat) in the startup folder of your Windows machine. (For Windows 10, C: \ Users \\ AppData \ Roaming \ Microsoft \ Windows \ Start Menu \ Programs \ Startup)
rmdir %temp% /s /q md %temp%
Tushar dwivedi
source share