Permalink
Browse files

Fixing service problems by specifying a new provider. Changed the sta…

…tus function in the jira service script to detect the process and double check in jps
  • Loading branch information...
1 parent 4e3fe08 commit b4a86af2d9c2f04c6ffce1fc90ec426438194b7f @brycejohnson brycejohnson committed Oct 31, 2012
Showing with 23 additions and 4 deletions.
  1. +8 −3 manifests/service.pp
  2. +15 −1 templates/etc/rc.d/init.d/jira.erb
View
11 manifests/service.pp
@@ -16,9 +16,14 @@
class jira::service {
service { 'jira':
+ provider => base,
ensure => 'running',
- name => 'jira',
- enable => true,
+ start => '/etc/init.d/jira start',
+ restart => '/etc/init.d/jira restart',
+ stop => '/etc/init.d/jira stop',
+ status => '/etc/init.d/jira status',
require => Class['jira::config'],
}
-}
+}
+ #status => "pg_lsclusters -h | awk 'BEGIN {rc=0} {if (\$4 != \"online\") rc=3} END { exit rc }'",
+#/opt/java/jdk1.6.0_33/bin/jps |grep Bootstrap # but has high risk for any tomcadt
View
16 templates/etc/rc.d/init.d/jira.erb
@@ -60,6 +60,20 @@ function start() {
return $RETVAL
}
+function status() {
+
+ ps -ef |grep $SERVICE |grep -v grep |awk '{ print $2 }' | <%= scope.lookupvar('jira::params::javahome') %>/bin/jps |grep -v Jps |grep -v grep > /dev/null
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ];then
+ echo "$SERVICE is running"
+ return $RETVAL
+ else
+ echo "$SERVICE is stopped"
+ return $RETVAL
+ fi
+
+}
+
function execute() {
@@ -71,7 +85,7 @@ function execute() {
stop
;;
status)
- status $SERVICE
+ status
;;
restart)
restart

0 comments on commit b4a86af

Please sign in to comment.