工具箱

Ubuntu使用ssh远程打开terminal执行脚本

2019-12-25  本文已影响0人  像鸣人

gui-launcher

#!/bin/bash -e
# NAME: gui-launcher
# Check whether the user is logged-in
while [ -z "$(pgrep gnome-session -n -U $UID)" ]; do sleep 3; done
# Export the current desktop session environment variables
export $(xargs -0 -a "/proc/$(pgrep gnome-session -n -U $UID)/environ")
# Execute the input command
#nohup "$@" >/dev/null 2>&1 &
source "$@"
exit 0

remote_start.sh

terminator -x  bash -c "/home/u1/startup.sh"

ssh命令

ssh u1@192.168.1.x "/home/u1/gui-launcher remote_start.sh"
上一篇 下一篇

猜你喜欢

热点阅读