I use jenkins master-slave configuration for capturing Performance metrics of a product. We have observed that jenkins-slave tends to accumulate memory and thus influences the Performance metrics being captured.
To ensure consistency of the metrics being captured, we are thinking of restarting jenkins slave every day from the master, when there are no jobs running on the slave. Is this feasible?
How can we accomplish it?
Note: Using jenkins-slave as a service is not an option because we are having other security access issues with it.
2) From a command window, “shutdown /r /t 0” will restart the machine. If you're not running as a service you'll need to log in before the slave reconnects.
I know this answer is coming in a bit late :
This is how I did the same for the same reasons, not sure if this is the best way to achieve this, but it solved many of our problems :
For Windows Machines :
For Mac Machines :
The process is comparatively easier on mac. First, make a job to run "shutdown -r now" on Mac node
The node should simply be setup to get connected via ssh. That will take care of bringing it up online on Jenkins.
This was the "execute shell" part of my script to restart 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:
It's not exactly related to the question, but may be useful for the situation that you specified. It may be a good idea to add a batch script to clean temp files on startup of Windows machines. Add following to a batch script (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%
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With