linux - Running Jconsole from a service: CentOS -


i installed tomcat on centos 6.3 machine , made service creating /etc/init.d/tomcat file. works basic start, stop, restart , status functionality fine.

i use jconsole on servers often, thought nice build functionality service (by running service tomcat monitor) instead of having run ps aux|grep java , running jconsole <java pid> .

here service script (just monitor section):

monitor)         # check tomcat pid (greps separated prevent returning single grep pid)         found_pid=$(ps aux |grep  $java_home/bin/ | grep java |awk -f' ' '{print $2}')         if [[ $found_pid ]]                         echo -e $java_home/bin/jconsole $found_pid                 $java_home/bin/jconsole $found_pid         else                 echo -e "failed: tomcat not running";         fi ;; 

everything inside of monitor section works when run bash script directly works, when service calls it, hangs @ jconsole line , doesn't anything.

and when run service tomcat monitor, correct path output, know path correct.

is there way jconsole work when called services script?


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -