wmctrl在终端中按预期工作,但不作为启动应用程序

时间:2014-03-31 15:32:44

标签: ubuntu sh

用于打开后台VLC播放器的Shell脚本和用于切换DHCP服务器状态的Shell脚本最终专注于终端窗口,从终端执行时效果很好,但在从Ubuntu启动应用程序执行时失败。

Starter.sh:

#!/bin/sh -e

/usr/bin/cvlc /var/www/stream.ts --sout '#rtp{dst=239.1.1.1,port=1234,mux=ts,ttl=1}' --loop >/dev/null 2>/dev/null &
gnome-terminal --full-screen --title "DHCP" -e /home/user/dhcp.sh &
sleep 4
/usr/bin/wmctrl -a "DHCP"

和dhcp.sh:

#!/bin/sh

INPUT=START
echo "*** DHCP-Server stopped. ***"  

while [ "$INPUT" != "SHUTDOWN" ]
do
read INPUT
if [ "$INPUT" = "START" ]; then 
    echo "*** DHCP-Server started. ***" 
    sudo service isc-dhcp-server start 2>/dev/null 1>/dev/null
fi;
if [ "$INPUT" = "STOP" ]; then
    echo "*** DHCP-Server stopped. ***"  
    sudo service isc-dhcp-server stop 2>/dev/null 1>/dev/null
fi;
done

#Shutdown
echo "*** Shutdown ***"  
sudo service isc-dhcp-server stop 2>/dev/null 1>/dev/null
sudo halt -p
exit 0

我的程序已启动,但聚焦部分无效。

0 个答案:

没有答案