Chinaunix
标题:
[求助]关于stop命令的用法
[打印本页]
作者:
simonlive
时间:
2009-05-25 18:59
标题:
[求助]关于stop命令的用法
在看unix.shell.by.example.4.editon
在第八章的末尾提到了shell内置命令,其中有个stop命令。是这么介绍的
stop pid Halt execution of the process number PID
man stop里面说的很简单,就是stop jobname
我写了个脚本叫time.sh,要运行10秒。我让time.sh在后台运行,然后
stop time.sh
shell提示找不到名为time.sh的job。
[
本帖最后由 simonlive 于 2009-5-25 19:50 编辑
]
作者:
wtuter
时间:
2009-05-25 19:55
标题:
回复 #1 simonlive 的帖子
time.sh运行完了,
作者:
simonlive
时间:
2009-05-25 19:59
输入stop命令的时候,time.sh还在后台运行
作者:
amxiaomao
时间:
2009-05-25 20:06
将指定作业号的后台作业挂起.
stop time.sh #
未测试
[
本帖最后由 amxiaomao 于 2009-5-25 20:11 编辑
]
作者:
simonlive
时间:
2009-05-25 20:12
[root@daniel-laptop shell]# time.sh &
count to 20:
[1] 4559
[root@daniel-laptop shell]# stop time.sh &
stop: Unknown job: time.sh
[2] 4565
[2]+ Exit 1 stop time.sh
还是不行啊
作者:
simonlive
时间:
2009-05-25 20:14
这是time.sh的内容
#! /bin/sh
#scriptname: time.sh
#test sleep command
echo "count to 20:"
i=0
while [ $i -lt 20 ]
do
sleep 2
echo -n . >> ./time.out
i=`expr $i + 1`
done
~
作者:
welcome008
时间:
2009-05-25 23:43
不应该跟程序名吧?
是不是应该跟1?
作者:
simonlive
时间:
2009-05-26 00:16
原帖由
welcome008
于 2009-5-25 23:43 发表
不应该跟程序名吧?
是不是应该跟1?
其实程序名是可以,只是我不知道该怎么用
用1貌似可以,不过shell的回复是
[root@daniel-laptop shell]# stop -i 1
stop: Job not changed: logd
time.sh还是在后台运行。
作者:
waker
时间:
2009-05-26 08:58
stop %time.sh
作者:
blackold
时间:
2009-05-26 11:51
也可以通过作业号来引用作业。
作者:
simonlive
时间:
2009-05-26 12:41
原帖由
waker
于 2009-5-26 08:58 发表
stop %time.sh
试过了,提示:
stop: Unknown job: %time.sh
作者:
simonlive
时间:
2009-06-02 13:53
差点把这个帖子给忘了,再顶下。
作者:
alfred119
时间:
2009-06-02 14:08
关注中!
作者:
merlin852
时间:
2009-06-02 14:26
stop %1 试下
作者:
simonlive
时间:
2009-06-02 15:13
[root@daniel-laptop shell]# time.sh &
count to 20:
[1] 18467
[root@daniel-laptop shell]# stop %1
stop: Unknown job: %1
[root@daniel-laptop shell]#
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2