Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
368 views
in Technique[技术] by (71.8m points)

unix - 在Solaris中使用ps看不到完整命令(Full command not visible using ps in solaris)

the command that was run by cronjob

(由cronjob运行的命令)

bin/bash /abc/bcd/def/ghi/connectivity/connectivity_script.sh start tof as abcde with abc/abc.prop

But while i try to see this process using

(但是当我尝试使用)

/usr/ucb/ps -auwwwxxxx | egrep "connectivity_script.sh"  | cat

i just see the below , but not the entire command.

(我只看到下面的内容,而不是整个命令。)

bin/bash /abc/bcd/def/ghi/connectivity/connectivity_script.sh start tof as

How to fetch the entire command that was run using ps as i need to know which property file has been used?

(如何获取使用ps运行的整个命令,因为我需要知道已使用哪个属性文件?)

abc/abc.prop in this case

(在这种情况下abc / abc.prop)

  ask by LearningCpp translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You may use in Solaris:

(您可以在Solaris中使用:)

pargs -l PID

to get all arguments of process in one line if you know its PID.

(如果知道进程的PID,则将其所有参数放在一行中。)

Also you may get the particular argument of process in such way:

(您也可以通过以下方式获得过程的特定论点:)

pargs -a PID | grep 'argv[8]' | cut -d: -f 2 

Or you may use ps with options if you know only one of process arguments:

(或者,如果您只知道以下过程参数之一,则可以将ps与选项一起使用:)

/usr/bin/ps -A -o pid,args | grep connectivity_script.sh | grep -v grep

In older Solaris versions ouput of arguments in /usr/bin/ps is limited with 80 chars, so you need two-steps to do: 1) get PID from ps, 2) get full args from pargs.

(在较早的Solaris版本中,/ usr / bin / ps中的参数输出限制为80个字符,因此您需要执行两个步骤:1)从ps获取PID,2)从pargs获取完整args。)

PID=$(/usr/bin/ps -A -o pid,args | 
      grep connectivity_script.sh | 
      grep -v grep | 
      cut -d" " -f 1 )
pargs -l $PID

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...