1

There is an existing question here on how to safely restart Jenkins:

How to safe restart Jenkins?

However, all the answers are either HTTP(s) options or using the jenkins-cli.jar CLI route.

I want to be able to safely restart the Jenkins environment from a script running on the Master host (a Debian Linux system, the script is running from 'cron' as root)

The Jenkins GUI is using LDAP via the company Active Directory to manage logins, so creating an extra user for this is non trivial (and I don't want to have an extra user open to HTTP Jenkins access if I don't absolutely have to), and using the original default "admin" user isn't possible because Jenkins only allows login from one "security realm".

The scripts are able to uncleanly restart Jenkins (because they can restart the processes), but surely it is possible to signal a clean restart somehow.

One of the answers in the linked question suggests "/etc/init.d/jenkins safeRestart", but that isn't a valid command.

1 Answers1

1

Assuming Jenkins is installed via a package which installs a systemd unit file:

systemctl restart jenkins
jayhendren
  • 3,022
  • 8
  • 16