Restart jenkins slave from master

I am using the master-slen jenkins configuration to record product performance metrics. We noticed that the jenkins slave tends to accumulate memory and, thus, affects the performance indicators that were recorded.

To ensure the consistency of the metrics taken, we think about restarting the Jeynins every day from the master, when tasks are not performed on the slave. Is it possible?

How can we do this?

Note. Using jenkins-slave as a service is not an option, because we have other security access issues.

+7
jenkins master-slave
source share
2 answers

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:

  • The process is relatively small on mac. First do the shutdown -r now task on the Mac node

  • node should just be configured to connect via ssh. That will take care of bringing him online to Jenkins.

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% 
+5
source share

If you still need an answer: https://wiki.apache.org/general/Jenkins#How_do_I_restart_a_Jenkins_Unix_Slave.3F

Although, I just disconnected, and then I saw that the processes worked in a subordinate. I should not have killed them manually. Then start the slave and start it.

This is good from the web interface. I have not searched CLI for this yet.

+2
source share

All Articles