pid

Linux启动,重启,停止java服务shell脚本

匿名 (未验证) 提交于 2019-12-02 21:56:30
代码 脚本 server.sh #!/bin/bash app = 'xxxxxx.jar' args = '-Xms2g -Xmx2g -Dspring.profiles.active=dev' cmd = $1 pid = ` ps -ef | grep java | grep $app | awk '{print $2 }' ` startup ( ) { nohup java -jar $args $app & tail -f nohup.out } if [ ! $cmd ] ; then echo "Please specify args 'start|restart|stop'" exit fi if [ $cmd == 'start' ] ; then if [ ! $pid ] ; then startup else echo " $app is running! pid= $pid " fi fi if [ $cmd == 'restart' ] ; then if [ $pid ] then echo " $pid will be killed after 3 seconds!" sleep 3 kill -9 $pid fi startup fi if [ $cmd == 'stop' ] ; then if [ $pid ] ; then echo "

GitLab安装及使用

匿名 (未验证) 提交于 2019-12-02 21:53:52
  GitLab拥有与Github类似的功能,能够浏览源代码,管理缺陷和注释。可以管理团队对仓库的访问,它非常易于浏览提交过的版本并提供一个文件历史库。它还提供一个代码片段收集功能可以轻松实现代码复用,便于日后有需要的时候进行查找。 1. GitLab安装与配置 1.1. 基础环境准备 1 [root@mini04 ~]# yum install -y curl policycoreutils openssh-server openssh-clients postfix 2 ……………… 3 [root@mini04 ~]# systemctl start postfix 1.2. 配置yum源   注:由于网络问题,国内用户,建议使用清华大学的镜像源进行安装: 1 [root@mini04 ~]# vim /etc/yum.repos.d/gitlab-ce.repo 2 [gitlab-ce] 3 name=gitlab-ce 4 baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/ 5 repo_gpgcheck=0 6 gpgcheck=0 7 enabled=1 8 gpgkey=https://packages.gitlab.com/gpg.key 1.3. 更新本地yum缓存 1 [root

Java进程cpu占用过高快速定位

匿名 (未验证) 提交于 2019-12-02 21:52:03
1 找到高消耗cpu的进程,使用ProcessExplorer工具查看进程中的哪个线程cpu使用率过高 2 在ProcessExplorer中选中要查看的进程,右键选择properties,查看哪个线程频繁使用cpu 3 利用jstack命令输出运行栈信息 在cmd中输入Jstack -l pid >>123.txt pid是进程即应用的pid,123.txt是要输出的文件名字 4 将第2步查看的线程的十进制pid,转换成16进制,在123.txt中搜索,就可以看到这个线程中哪个部分在高消耗cpu 来源:51CTO 作者: liyunfei456 链接:https://blog.csdn.net/liyunfei456/article/details/100859398

BASH - Check if PID Exists

送分小仙女□ 提交于 2019-12-02 20:29:58
I want to stall the execution of my BASH script until a process is closed (I have the PID stored in a variable). I'm thinking while [PID IS RUNNING]; do sleep 500 done Most of the examples I have seen use /dev/null which seems to require root. Is there a way to do this without requiring root? Thank you very much in advance! kill -s 0 $pid will return success if $pid is running, failure otherwise, without actually sending a signal to the process, so you can use that in your if statement directly. wait $pid will wait on that process, replacing your whole loop. It seems like you want wait $pid

JVM性能调优监控工具jps、jstack、jmap、jhat、jstat、hprof使用详解 转至元数据结尾

不打扰是莪最后的温柔 提交于 2019-12-02 18:16:06
OutOfMemoryError,内存不足 内存容量 螺纹死锁 锁争用(锁争用) Java进程消耗CPU过高 A,jps(Java虚拟机进程状态工具) jps主要用于输出JVM中运行的进程状态信息。语法格式如下: jps [选项] [主机ID] 如果不指定hostid就默认为当前主机或服务器。 命令行参数选项说明如下: -q不输出类名,Jar名和纳入主方法的参数 -m输出预设主方法的参数 -l输出main类或Jar的全限名 -v输出JVM的参数 例如下面: root @ ubuntu:/#jps -m -l 2458 org.artifactory.standalone.main.Main /usr/local/artifactory-2.2.5/etc/jetty.xml 29920 com.sun.tools.hat.Main主端口9998 /tmp/dump.dat 3149 org.apache.catalina.startup.Bootstrap启动 30972 sun.tools.jps.Jps -m -l 8247 org.apache.catalina.startup.Bootstrap启动 25687 com.sun.tools.hat.Main-端口9999 dump.dat 21711 mrf-center.jar B,jstack

虚拟机工具

若如初见. 提交于 2019-12-02 17:23:57
jps java process status jps -l 主 类 全 名 jps -m 运 行 传 入 主 类 的 jps -v 虚 拟 机 参 数 jstat 类 加 载 , 内 存 , 垃 圾 收 集 , jit 编 译 信 息 、 https://docs.oracle.com/javase/8/docs/technotes/tools/unix/jstat.html jinfo 实 时 调 整 和 查 看 虚 拟 机 参 数 -XX:[+/-]option -XX:option=value jmap jmap -dump:formart=b,file=filepath pid jmap -histo pid jhat JVM heap Analysis Tool jstack jconsole 来源: https://www.cnblogs.com/snail-gao/p/11756547.html

How can I check from Ruby whether a process with a certain pid is running?

一世执手 提交于 2019-12-02 17:15:54
If there is more than one way, please list them. I only know of one, but I'm wondering if there is a cleaner, in-Ruby way. If it's a process you expect to "own" (e.g. you're using this to validate a pid for a process you control), you can just send sig 0 to it. >> Process.kill 0, 370 => 1 >> Process.kill 0, 2 Errno::ESRCH: No such process from (irb):5:in `kill' from (irb):5 >> tonystubblebine The difference between the Process.getpgid and Process::kill approaches seems to be what happens when the pid exists but is owned by another user. Process.getpgid will return an answer, Process::kill will

查看java内存命令

北战南征 提交于 2019-12-02 14:57:09
jinfo:可以输出并修改运行时的java 进程的opts。 jps:与unix上的ps类似,用来显示本地的java进程,可以查看本地运行着几个java程序,并显示他们的进程号。 jstat:一个极强的监视VM内存工具。可以用来监视VM内存内的各种堆和非堆的大小及其内存使用量。 jmap:打印出某个java进程(使用pid)内存内的所有'对象'的情况(如:产生那些对象,及其数量)。 jconsole:一个java GUI监视工具,可以以图表化的形式显示各种数据。并可通过远程连接监视远程的服务器VM。 详细:在使用这些工具前,先用JPS命令获取当前的每个JVM进程号,然后选择要查看的JVM。 jstat工具特别强大,有众多的可选项,详细查看堆内各个部分的使用量,以及加载类的数量。使用时,需加上查看进程的进程id,和所选参数。以下详细介绍各个参数的意义。 jstat -class pid:显示加载class的数量,及所占空间等信息。 jstat -compiler pid:显示VM实时编译的数量等信息。 jstat -gc pid:可以显示gc的信息,查看gc的次数,及时间。其中最后五项,分别是young gc的次数,young gc的时间,full gc的次数,full gc的时间,gc的总时间。 jstat -gccapacity:可以显示,VM内存中三代(young,old

How does a Linux/Unix Bash script know its own PID?

孤街醉人 提交于 2019-12-02 14:13:13
I have a script in Bash called Script.sh , and it needs to know its own PID (i.e. I need to get PID inside the Script.sh ) Any idea how to do this ? The variable '$$' contains the PID. tvanfosson use $BASHPID or $$ See the manual for more information, including differences between the two. TL;DRTFM $$ Expands to the process ID of the shell. In a () subshell, it expands to the process ID of the invoking shell, not the subshell. $BASHPID Expands to the process ID of the current Bash process. In a () subshell, it expands to the process ID of the subshell In addition to the example given in the

Get PID of process after fork in Qt

前提是你 提交于 2019-12-02 13:21:33
问题 I am creating a Qt/C++ console application which successfully forks. When I call QCoreApplication::applicationPid() before fork, and then after fork (in the child), I get the same pid. I realize I could just use the return value from fork() but I'm trying to do things the Qt way. Is there a better/right way to get the PID of the child (from within the child) in Qt? And out of curiosity, why isn't QCoreApplication::applicationPid() providing the new PID? I assume it's now providing the ppid...