The init script I have for a service I am managing in puppet is all messed up so instead of using the standard 'ensure = > running' and waiting for an exit code of 0 I have to write my own status check, as follows
PHP Code:
service { 'myservice':
ensure => 'running',
hasstatus => false,
status => 'ps -ef | grep "connector-logging.jar:/opt/gsa/Connectors/Oracle/Tomcat/bin/bootstrap.jar" | grep -v grep | cut -d \' \' -f4',
enable => true,
}
When I run the ps command on the command line it works, as in it returns the PID when the service is running and doesn't return anything if the service is stopped.
Yet, when I run puppet agent it doesn't do anything if the service is stopped.
As a side note when I change the status command from using cut to awk, like so.
PHP Code:
status => 'ps -ef | grep "connector-logging.jar:/opt/gsa/Connectors/Oracle/Tomcat/bin/bootstrap.jar" | grep -v grep | awk {\'print \$2\'}',
Running puppet with this status check will entail that the service is never running and will also attempt to start it even though the process already exists.
Anyone with experience with this?