Commit efe67a46d7980e93f2fd1eef076d820ab0dff448

Authored by Antonio Terceiro
1 parent c5b5a296

move "is noosfero running?" test to script/production

Showing 2 changed files with 11 additions and 1 deletions   Show diff stats
etc/init.d/noosfero
... ... @@ -123,7 +123,7 @@ do_restart() {
123 123 }
124 124  
125 125 running(){
126   - pgrep -u noosfero -f 'thin server' > /dev/null
  126 + main_script running
127 127 }
128 128  
129 129 case "$1" in
... ...
script/production
... ... @@ -84,6 +84,12 @@ environments_loop() {
84 84 fi
85 85 }
86 86  
  87 +do_running() {
  88 + pids=$(cat tmp/pids/thin.*.pid 2>/dev/null || true)
  89 + # passes if any of $pids exist, fails otherwise
  90 + kill -0 $pids > /dev/null 2>&1
  91 +}
  92 +
87 93 case "$ACTION" in
88 94 start|stop)
89 95 do_$ACTION
... ... @@ -100,6 +106,10 @@ case "$ACTION" in
100 106 do_restart
101 107 ;;
102 108  
  109 + running)
  110 + do_running
  111 + ;;
  112 +
103 113 *)
104 114 echo "usage: $0 start|stop|restart|run"
105 115 exit 1
... ...