Ask Your Question
0

Ensure service running with specific arguments

asked 2014-11-18 12:04:24 -0500

nullpass gravatar image

How can I make sure a process is running with known arguments? ie: ps -ef|grep "/bin/foo -t bar"

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-11-18 16:49:08 -0500

Stefan gravatar image

In general puppet can only manage OS services which normally don't take any arguments. You can trick puppet here by making sure puppet will look into the process table to determine the current state (instead running service foo status or similar) and define an alternate pattern

service { "foo":
  ensure    => running,
  hasstatus => false,
  pattern   => '/bin/foo -t bar',
}

but be aware that if the service runs with a wrong parameter, puppet will start the service again without killing the first one first (if the initscript does not do that for you) so this might not be what you want.

I am kind of wondering: Do you even have an initscript for your service or are you merly want to control a process with puppet? Because I would not encourage the latter: All the intelligence should be put into a proper startup script and puppet should only call that.

edit flag offensive delete link more

Comments

Confirmed that works, thanks. I know it's not ideal, but that's the nature of the project I have to work on right now. Cheers

nullpass gravatar imagenullpass ( 2014-11-20 10:02:39 -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

Stats

Asked: 2014-11-18 12:04:24 -0500

Seen: 1,026 times

Last updated: Nov 18 '14