我有一個正在運行的 TeamViewer,在啟動 TeamViewer 的 GUI 後可以成功連接到它。但不幸的是,當 TeamViewer 的 GUI 未啟動時,我無法連接到我的電腦。所有可以找到的文件都表明運行 TeamViewer 守護程序teamviewerd
足以遠端連接到計算機,但對我來說似乎並非如此。
沒有 TeamViewer GUI(僅 teamviewerd)
輸出teamviewer status
:
TeamViewer 11.0.57095 (DEB)
teamviewerd status ● teamviewerd.service - TeamViewer remote control daemon
Loaded: loaded (/etc/systemd/system/teamviewerd.service; enabled; vendor preset: enabled)
Active: active (running) since Sa 2016-04-30 17:01:55 CEST; 11min ago
Process: 15518 ExecStart=/opt/teamviewer/tv_bin/teamviewerd -d (code=exited, status=0/SUCCESS)
Main PID: 15521 (teamviewerd)
CGroup: /system.slice/teamviewerd.service
└─15521 /opt/teamviewer/tv_bin/teamviewerd -d
Apr 30 17:01:54 rvaio systemd[1]: Starting TeamViewer remote control daemon...
Apr 30 17:01:55 rvaio systemd[1]: teamviewerd.service: PID file /var/run/teamviewerd.pid not readable (yet?) after start: No such file or directory
Apr 30 17:01:55 rvaio systemd[1]: Started TeamViewer remote control daemon.
TeamViewer ID: 123456789
輸出sudo netstat -ntap | grep teamviewer
:
tcp 0 0 0.0.0.0:5938 0.0.0.0:* LISTEN 1447/teamviewerd
tcp 0 0 127.0.0.1:5940 0.0.0.0:* LISTEN 1447/teamviewerd
tcp6 0 0 :::5938 :::* LISTEN 1447/teamviewerd
啟動 TeamViewer GUI 後
輸出teamviewer status
:
TeamViewer 11.0.57095 (DEB)
teamviewerd status ● teamviewerd.service - TeamViewer remote control daemon
Loaded: loaded (/etc/systemd/system/teamviewerd.service; enabled; vendor preset: enabled)
Active: active (running) since Sa 2016-04-30 17:01:55 CEST; 18min ago
Process: 15518 ExecStart=/opt/teamviewer/tv_bin/teamviewerd -d (code=exited, status=0/SUCCESS)
Main PID: 15521 (teamviewerd)
CGroup: /system.slice/teamviewerd.service
└─15521 /opt/teamviewer/tv_bin/teamviewerd -d
Apr 30 17:01:54 rvaio systemd[1]: Starting TeamViewer remote control daemon...
Apr 30 17:01:55 rvaio systemd[1]: teamviewerd.service: PID file /var/run/teamviewerd.pid not readable (yet?) after start: No such file or directory
Apr 30 17:01:55 rvaio systemd[1]: Started TeamViewer remote control daemon.
TeamViewer ID: 123456789
輸出sudo netstat -ntap | grep teamviewer
:
tcp 0 0 0.0.0.0:5938 0.0.0.0:* LISTEN 15521/teamviewerd
tcp 0 0 127.0.0.1:5940 0.0.0.0:* LISTEN 15521/teamviewerd
tcp 0 0 127.0.0.1:5940 127.0.0.1:48475 ESTABLISHED 15521/teamviewerd
tcp6 0 0 :::5938 :::* LISTEN 15521/teamviewerd
tcp6 0 0 2003:72:2d76:2701:46132 2a01:488:2001:1c01:5938 ESTABLISHED 15521/teamviewerd
正如您所看到的,啟動 GUI 會導致建立兩個連接,這與僅使用守護程序不同。
答案1
我也遇到這個問題,發現可能是程式本身的問題。我的解決方案是使用 Ubuntu 中的一個名為 gDevilspie 的程式。
這是我設定 TeamViewer 的方法
這是我使用的設定:
對於 TeamViewer:
application_name equals Computers & Contacts
window_name equals Computers & Contacts
螢幕截圖顯示了該視窗的操作
對於 TeamViewer2:
application_name equals TeamViewer
window_name equals TeamViewer
我用於此規則的操作是: 關閉
這就是我的 TeamViewer 的設定方式。
現在,即使它在托盤中運行...如果我想查看它,我無法單擊圖標並選擇“顯示 TeamViewer”,否則它只會再次打開和關閉。我必須停止 gDevilspie 才能打開/查看該程式..請記住這一點
答案2
擴展於@JohnOrion 發布了什麼,我有一個更可靠的解決方案。它不會總是殺死 TeamViewer 的窗口,而是在程式啟動時關閉兩個窗口,然後在以後停止關閉它們。這是您需要做的:
安裝
devilspie
並procmail
。sudo apt-get install devilspie procmail
將其寫入
~/.devilspie/TeamViewer.ds
:(if (or (and (is (application_name) "TeamViewer") (is (window_name) "TeamViewer") ) (and (is (application_name) "Computers & Contacts") (is (window_name) "Computers & Contacts") ) ) (begin (close) (spawn_async "~/bin/teamviewer/tvwindow") ) )
建立一個您想要放置一些腳本的目錄。我選擇了
~/bin/teamviewer
,但你可以選擇你喜歡的任何東西。如果變更此目錄,請確保也在步驟 2 的腳本中變更它。mkdir -p ~/bin/teamviewer
將這些內容寫入
~/bin/teamviewer/tvwindow
(如果需要,請再次更改目錄):#!/usr/bin/env bash source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/vars" lockfile teamviewerstartup.lock # read remaining windows REMAINING_WINDOWS=$(cat "$REMAINING_WINDOWS_FILE") REMAINING_WINDOWS_NOW=$(($REMAINING_WINDOWS - 1)) if [ $REMAINING_WINDOWS_NOW -eq 0 ]; then # TeamViewer has started up completely, kill devilspie kill $(cat "$DEVILSPIE_PID_FILE") # Also remove temporary files rm -f "$DEVILSPIE_PID_FILE" rm -f "$REMAINING_WINDOWS_FILE" else # One or more windows to go, write the decremented value to the file echo -n "$REMAINING_WINDOWS_NOW" > "$REMAINING_WINDOWS_FILE" fi rm -f teamviewerstartup.lock
將這些內容寫入
~/bin/teamviewer/tvminimizedstart
(如果需要,請再次更改目錄):#!/usr/bin/env bash source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/vars" nohup devilspie > /dev/null 2>&1 & DEVILSPIE_PID=$! lockfile teamviewerstartup.lock # Write PID of devilspie process echo -n "$DEVILSPIE_PID" > "$DEVILSPIE_PID_FILE" # Set remaining to be closed windows to 2 echo -n "2" > "$REMAINING_WINDOWS_FILE" rm -f teamviewerstartup.lock nohup teamviewer >/dev/null 2>&1 &
將這些內容寫入
~/bin/teamviewer/vars
(如果需要,請再次更改目錄):#!/usr/bin/env bash DEVILSPIE_PID_FILE="$HOME/bin/teamviewer/devilspiepid" REMAINING_WINDOWS_FILE="$HOME/bin/teamviewer/remaining-windows"
使它們可執行。
chmod +x ~/bin/teamviewer/tvwindow ~/bin/teamviewer/tvminimizedstart ~/bin/teamviewer/vars
要使用此解決方案,運行tvminimizedstart
腳本:
~/bin/teamviewer/tvminimizedstart