[Desktop Entry]
Name=OpenVPN
Comment=Запуск OpenVPN от имени пользователя qwe-internet
Exec=sh -c "su -l qwe-internet -c 'DISPLAY=:0 openvpn --config /opt/123.ovpn'"
Terminal=true
Type=Application
Categories=Network;Application;
#!/bin/bash
exit_script() {
echo "Printing something special!"
echo "Maybe executing other commands!"
trap - SIGINT SIGTERM # clear the trap
kill -- -$$ # Sends SIGTERM to child/sub processes }
trap exit_script SIGINT SIGTERM
echo "Some other text"
#other commands here
sleep infinity
Exec=sh -c "echo $$ | tee /tmp/qwe123.pid; su -l qwe-internet -c 'DISPLAY=:0 openvpn --config /opt/123.ovpn'"
* * * * * ps -q $(cat /tmp/qwe123.pid) >/dev/null 2>&1 || команда-на-отключение-ovpn