There are many methods mentioned on the Internet, but none of them work. It may be a problem with the jenkins version, but the details are not clear.
-
Check environment variable settings: Make sure the environment variables are set correctly when starting Jenkins
BUILD_ID=DONTKILLME
.-D
You can set environment variables by adding options to the Jenkins startup script or command line , for example:java -jar jenkins.war -DBUILD_ID=DONTKILLME
----invalid
-
Check operating system permissions: On some operating systems, administrator or superuser privileges are required to set and pass environment variables. Make sure you have sufficient privileges to set
BUILD_ID=DONTKILLME
environment variables. ---invalid -
Restart the Jenkins service: After applying new environment variable settings or modifying the configuration, restart the Jenkins service to ensure the changes take effect. ----invalid
-
Before executing the .sh file, add BUILD_ID=dontKillMe. invalid
Final solution:
source /etc/profile
export JENKINS_NODE_COOKIE=dontKillMe
---efficient