0

I have a custom upstart service which I'm trying to automate via Chef. The chef flow is like this: - Create /etc/init/myservice.conf, notify restart myservice (if conf file changes) - Start myservice

The Chef service restart is actually carried out as /sbin/stop and /sbin/start So, if my service isn't already running, the restart fails saying that /sbin/stop myservice returned 1

Is there a way I can return 0 on /sbin/stop myservice if the service is already in a stopped state?

1 Answer 1

0

I had the same issue with tomcat and chef, use this:

/sbin/status tomcat_7 | grep -q "stop/waiting" || /sbin/stop tomcat_7

For start:

/sbin/status tomcat_7 | grep -q "start/running" || /sbin/start tomcat_7

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .