AIX脚本调用 - 执行延迟

时间:2014-11-20 05:42:40

标签: bash shell unix scripting sh

我有一个调用另一个shell脚本B的shell脚本A.

以某种方式调用shell脚本B需要很长时间才能真正开始执行。大约20秒左右。

我通过在被调用的shell脚本的第一行上执行echo date来确认这一点。可能是什么问题?我不确定我能看到什么。

调用图很简单

脚本A

echo "Just Started Executing A" `date`
. B
echo "Just Finished Executing A" `date`

脚本B

echo "Just Started Executing B" `date`

输出

Just Started Executing A Thu Nov 20 02:31:33 ADT 2014
Just Started Executing B Thu Nov 20 02:31:58 ADT 2014
Just Finished Executing A Thu Nov 20 02:31:58 ADT 2014

我使用time命令来测量调用脚本B所花费的时间,分布就是这样。

real    0m25.56s
user    0m17.12s
sys     0m0.27s

我已确认服务器上没有CPU或内存不足。

| CPU-Utilisation-Small-View ==========qEntitledCPU=  7.00 UsedCPU=  2.609==============================================q|
|Logical  CPUs              0----------25-----------50----------75----------100                                          |
|CPU User%  Sys% Wait% Idle%|           |            |           |            |                                          |
|  0  21.5  22.0   0.0  56.5|UUUUUUUUUUsssssssssss            >               |                                          |
|  1  31.5  19.0   0.0  49.5|UUUUUUUUUUUUUUUsssssssss                         >                                          |
|  2  40.0  32.5   0.0  27.5|UUUUUUUUUUUUUUUUUUUUssssssssssssssss      >      |                                          |
|  3  33.0   1.0   0.0  66.0|UUUUUUUUUUUUUUUU                   >             |                                          |
|  4  21.5  27.5   0.0  51.0|UUUUUUUUUUsssssssssssss                     >    |                                          |
|  5  37.5   5.0   0.0  57.5|UUUUUUUUUUUUUUUUUUss        >                    |                                          |
|  6   9.0  16.5   0.0  74.5|UUUUssssssss                                 >   |                                          |
|  7   0.5   4.5   0.0  95.0|ss                                      >        |                                          |
|  8   0.0   0.0   0.0 100.0|                                     >           |                                          |
|  9   0.0   0.0   0.0 100.0|                    >                            |                                          |
| 10   0.0   0.0   0.0 100.0|                          >                      |                                          |
| 11   0.0   0.0   0.0 100.0|  >                                              |                                          |
| 12   0.0   0.0   0.0 100.0|                               >                 |                                          |
| 13   0.0   0.0   0.0 100.0|>                                                |             

请指导。

1 个答案:

答案 0 :(得分:0)

这个问题得到了解决。这就是我做的事情。 当这个过程花了很长时间才开始时,我注意到它的PID。为了让我更容易,它作为顶级进程出现在topas中,所以我可以毫无问题地获得PID。

我做了一个killl -6来生成一个核心转储,并在花费这么长时间时找出进程正在做什么。核心转储说了这个。

IOT/Abort trap in . at 0x10006c3c
0x10006c3c (???) 80410014         lwz   r2,0x14(r1)
(dbx) where
sh_done_15_8(??, ??) at 0x10006c3c
read(??, ??, ??) at 0xd0385ed4
io_readbuff(??) at 0x1000467c
**hist_eof() at 0x10016db4
hist_open() at 0x100173f4**
item(??) at 0x100247a0
term(??) at 0x10024ce8
list(??) at 0x10024bdc
sh_cmd(??, ??) at 0x10024e5c
sh_cmd(??, ??) at 0x10024f10
sh_parse(??, ??) at 0x10025970
sh_eval(??) at 0x1001bf10
b_dot(??, ??) at 0x1001ba60
xec_builtin(??, ??, ??, ??, ??, ??) at 0x1001e24c
xec_switch(??, ??, ??, ??, ??) at 0x1001e760
sh_exec(??, ??, ??) at 0x10020078
exfile() at 0x10001750
main(??, ??) at 0x1000092c

凭直觉,我检查了用户的历史文件,这是巨大的。大约500 MB。

删除了历史文件...... VOILA !!!问题得到了解决。

相关问题