Mani
Mani

Reputation: 11

Deleted config.xml when Jenkins server was running

I deleted "config.xml" file in the Jenkins source folder when Jenkins was running.
When I restarted Jenkins service, it gives Error:

Cannot read config.xml 

The config files for all the jobs running are there.
Is there any way through which I can start Jenkins and configure it again ?

Upvotes: 1

Views: 3032

Answers (2)

P. Ntende
P. Ntende

Reputation: 11

Jenkins keeps a history of the configuration, so you should be able to recover your deleted file from /var/lib/jenkins/config-history/[backup date folder]

Upvotes: 1

Devesh
Devesh

Reputation: 866

All you need is to create a config.xml in JENKINS_HOME directory with below 3 elements in it:

  • VERSION
  • WORKSPACE DIRECTORY
  • BUILDS DIRECTORY

I have tested this in my Jenkins instance.

<?xml version='1.0' encoding='UTF-8' ?>
<hudson>
  <version>1.581</version>
  <workspaceDir>${JENKINS_HOME}/workspace/${ITEM_FULLNAME}</workspaceDir>
  <buildsDir>${ITEM_ROOTDIR}/builds</buildsDir>
</hudson>

Upvotes: 4

Related Questions