add start_vnc
This commit is contained in:
parent
92bcf622a9
commit
47d2132170
|
@ -0,0 +1,9 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
Name=Bildschirm für Techniker freigeben
|
||||||
|
Exec=/usr/local/bin/start_vnc.sh
|
||||||
|
Type=Application
|
||||||
|
Terminal=false
|
||||||
|
StartupWMClass=zenity
|
||||||
|
StartupNotify=true
|
||||||
|
Categories=Utility
|
||||||
|
Icon=/usr/share/icons/Adwaita/48x48/legacy/face-glasses.png
|
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
USERNAME=${USER,,}
|
||||||
|
LOCK_FILE=/tmp/start_vnc_$USERNAME.lock
|
||||||
|
ICON=application-x-vnc
|
||||||
|
SSH_HOST=ulrich.earth
|
||||||
|
SSH_PORT=2222
|
||||||
|
SSH_USER=karin
|
||||||
|
|
||||||
|
(
|
||||||
|
flock -n 200 || { echo "already running, exiting."; exit 1; }
|
||||||
|
gsettings set org.gnome.desktop.remote-desktop.vnc auth-method 'password'
|
||||||
|
gsettings set org.gnome.desktop.remote-desktop.vnc view-only false
|
||||||
|
gsettings set org.gnome.desktop.remote-desktop.vnc enable true
|
||||||
|
password=$(echo -e $(od -vAn -N3 -tu4 < /dev/urandom))
|
||||||
|
info_text="Bildschirmfreigabe aktiv! Passwort: $password"
|
||||||
|
echo -n "$password" | secret-tool store --label="GNOME Remote Desktop VNC password" "xdg:schema" "org.gnome.RemoteDesktop.VncPassword"
|
||||||
|
systemctl --user start gnome-remote-desktop.service
|
||||||
|
ssh -C -N -R 5900:localhost:5900 -p $SSH_PORT $SSH_USER@$SSH_HOST &
|
||||||
|
ssh_pid="$!"
|
||||||
|
zenity --title="Bildschirmfreigabe auf $(hostname)" --info --text="$info_text" --width=230 --ok-label="Beenden" --icon-name="$ICON"
|
||||||
|
kill $ssh_pid
|
||||||
|
systemctl --user stop gnome-remote-desktop.service
|
||||||
|
gsettings set org.gnome.desktop.remote-desktop.vnc enable false
|
||||||
|
) 200>"$LOCK_FILE"
|
Loading…
Reference in New Issue