I am trying to make qBittorrent run when a VPN connection starts. In my ovpn file I have:
script-security 2
up "/bin/up-openvpn"
and in my up-openvpn file I have:
#!/bin/bash
qbittorrent
However when the connection starts qbittorrent immediately returns an error saying it is unable to connect to X server and closes. This is however not a problem with qbittorrent, every program I try to run from my up script fails. If I replace qbittorrent with gedit for example I get the following in my openvpn terminal:
(gedit:10683): Gtk-WARNING **: cannot open display:
Wed Jan 8 17:54:08 2014 WARNING: Failed running command (--up/--down): external program exited with error status: 1
I can run simple commands from the up script like ifconfig with no problems but I can't seem to execute a program. I Tried using (qbittorrent &) and nohup as well to detach the program from the terminal but neither worked. I have been trying different things for the past 4 hours to no avail.
Does anyone know how to execute a program with --up? Thanks!