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

Ubuntu wmctrl在终端中按预期工作,但不作为启动应用程序,ubuntu,sh,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-ter

一个用于打开背景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
我的程序已启动,但聚焦部分不起作用