Ask Your Question
0

stop service before update it

asked 2013-11-28 17:11:28 -0500

rakkaus gravatar image

Hi guys! I strongly belive that puppet easily can do what I want, but I am new in puppet so I need to some advice...

I have a custom service (in fact it's a tomcat app) and I need stop it before upgrage, I have such work flow

1) My new version of tomcat as arrive as zip 2) when zip with new version was updated i need to stop service 3) remove old tomcat 4) unzip new version 5) start service

I think that step 1 is the key that should trigger other steps. I tried do this ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-11-28 18:30:42 -0500

Stefan gravatar image

The easiest way to do that is to write a shell script that does step 2 - 5 (stop service, remove tomcat, unzip new version, start service) and then trigger that script with notify and make sure it does only run after it's notified by specifying refreshonly (check the reference and the techniques section)

file { '/deploy/new_tomcat.zip':
  ensure => file,
  source => ...,
  notify => Exec['deploy_tomcat'],
}

exec { deploy_tomcat
  command     => 'your_custom_shell_script.sh',
  refreshonly => true,
}

but please note, that your shell script basically does what a package manager is used for, so you please consider to use an existing package or build your own ... (more)

edit flag offensive delete link more

Comments

Thank you a lot! but can you please explain me how exec with refreshonly will avoid self execution every 30 mins by `runinterval` ? which job refreshonly is doing? Does construction ...(more)

rakkaus gravatar imagerakkaus ( 2013-11-29 00:30:20 -0500 )edit

Refreshonly is explained in the links that I have provided. An exec resource will generally run a command if the resource is processed (= each runinterval) and whenever it receives a ...(more)

Stefan gravatar imageStefan ( 2013-11-29 11:00:57 -0500 )edit

Thank you a lot!

rakkaus gravatar imagerakkaus ( 2013-11-29 13:29:27 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-11-28 17:11:28 -0500

Seen: 604 times

Last updated: Nov 28 '13