I have troubles where jenkins gets slower and slower, then crashes. I will
be investigating the problem, but in the interim I created a script that
others might be interested in.
It is designed to perform a "safe restart" (which waits for builds to
finish).
I run this every 2 hours using cron:
0 */2 * * * $HOME/bin/restartjenkins.sh >> $HOME/logs/restartjenkins.log
Here's the script:
restartjenkins.sh
#!/bin/bash
JENKINSPROCESS=`ps -U jenkins | grep systemd`
if [[ -z $JENKINSPROCESS ]]
then
echo "ERROR: Jenkins Process not detected!!!...Trying to start"
# Attempt a normal start
sudo /etc/init.d/jenkins start
exit
fi
echo "Attempting Safe Jenkins Restart"
USER=xxxxxxxxxx
APITOKEN=xxxxxxxxxxxx
SERVER="http://localhost:8080"
CRUMB=$(curl --user $USER:$APITOKEN \
$SERVER/crumbIssuer/api/xml?xpath=concat\(
//crumbRequestField,%22:%22,//crumb\))
curl -X POST -u $USER:$APITOKEN -H "$CRUMB" "$SERVER/safeRestart"
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/d752bf4a-13b5-47f0-9bb1-6c1d3d2f6c77%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.