stop.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/sh
  2. # del crontab
  3. process_flag=$1
  4. if [ -z "$process_flag" ]; then
  5. process_flag=uav_proc_watcher
  6. fi
  7. count=`crontab -l 2>/dev/null | grep "$process_flag" | wc -l`
  8. if [ $count -ne 0 ]; then
  9. cronfile=/tmp/$process_flag".tmp"
  10. crontab -l | grep -v "$process_flag" > $cronfile
  11. crontab $cronfile
  12. rm -rf $cronfile
  13. fi
  14. # kill running watchers
  15. runing_watcher=$(ps -ef | grep "uav_proc_watcher.sh" | grep "$process_flag" | awk '{printf "%s ",$2}')
  16. for pid in $runing_watcher; do
  17. kill -9 "$pid"
  18. done
  19. javaHomeArray=(/opt/jdk1.7.0_45 /opt/jdk1.7.0_65 /opt/jdk1.7.0_71 /opt/jdk1.7.0_79 /opt/jdk1.7.0_80 /app/jdk1.7.0_79 /app/jdk1.7.0_80 /opt/jdk1.8.0_77 /opt/jdk1.8.0_121 /opt/jdk1.8.0_131)
  20. executeJava="java"
  21. for jhome in ${javaHomeArray[@]}
  22. do
  23. tmp="$jhome/bin/java"
  24. if [ -x "$tmp" ]; then
  25. executeJava=$tmp
  26. break
  27. fi
  28. done
  29. echo "using $executeJava"
  30. cd ..
  31. for i in lib/*;
  32. do CLASSPATH=$i:"$CLASSPATH";
  33. done
  34. export CLASSPATH=.:$CLASSPATH
  35. echo $CLASSPATH
  36. $executeJava -classpath $CLASSPATH com.creditease.agent.feature.nodeopagent.NodeOperCtrlClient $1 shutdown