如何将后台程序调到前台执行
本帖最后由 ShenDuYouLan 于 2013-10-12 16:05:52 编辑 我的系统是嵌入式linux,我将我自己的应用程序放到启动脚本里自动后台执行了,但是我想将它调回前台如何办呢?网上说fg+进程号 我试了不行啊?另外我的程序是多线程程序,名字是samd 下面的283起始那一个算我的主进程编号呢?
/ko.rel $ ps
PID Uid VmSize Stat Command
1 root 360 S init
2 root SWN [ksoftirqd/0]
3 root SW< [events/0]
4 root SW< [khelper]
5 root SW< [kthread]
16 root SW< [kblockd/0]
32 root SW [pdflush]
33 root SW [pdflush]
35 root SW< [aio/0]
34 root SW [kswapd0]
114 root SW [mtdblockd]
117 root SWN [jffs2_gcd_mtd1]
135 root 504 S -sh
158 root SW< [hieth_skber]
260 root 328 S insmod /lib/modules/2.6.14-hi3511v100dmeb-release/mis
270 root SW< [himci_queue]
278 root SW [mmcqd]
283 root 780 S ./samd
284 root 780 S ./samd
285 root 780 S ./samd
286 root 780 S ./samd
287 root 780 S ./samd
288 root 780 S ./samd
289 root 780 S ./samd
290 root 780 S ./samd
291 root 780 S ./samd
292 root 780 S ./samd
293 root 780 S ./samd
294 root 780 S ./samd
295 root 780 S ./samd
296 root 780 S ./samd
297 root 780 S ./samd
298 root 780 S ./samd
299 root 780 S ./samd
300 root 780 S ./samd
314 root 340 R ps
[解决办法]
jobs
hadoop3@linux240:~/zhangqi> cat sleep.sh
#!/bin/bash
/bin/sleep 30s
echo "*** I wake up ***"
hadoop3@linux240:~/zhangqi> ./sleep.sh &
[1] 30208
hadoop3@linux240:~/zhangqi> fg %1
./sleep.sh
*** I wake up ***
hadoop3@linux240:~/zhangqi> fg %1
-bash: fg: %1: no such job