- Clone this repository into your local system.
- Start a new python virtual environment:
$: sudo apt install virtualenv $: virtualenv -p python3 vpn_checker
- Activate the new virtual environment:
$: source vpn_checker/bin/activate
- Move into the repository source code.
- Install the python requirements for this project to work:
(vpn_checker)$: pip install -r requirements.txt
- Now you can run the VPN Checker service.
(vpn_checker)$: python main.py
-
Create a
vpn_checker.service
file into the /etc/systemd/system folder with the following content:[Unit] Description=VPN Checker Service After=network.target StartLimitIntervalSec=0 [Service] Type=simple Restart=always RestartSec=1 User=<TYPE YOUR USERNAME HERE> Environment="DISPLAY=:0.0" Environment="DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus" ExecStart=$VIRTUALENV_PATH/bin/python $SOURCES_PATH/main.py [Install] WantedBy=multi-user.target
NOTE: You need to change the values for the
DISPLAY
andDBUS_SESSION_BUS_ADDRESS
environment variables. Normally if you executeecho $DISPLAY
andecho $DBUS_SESSION_BUS_ADDRESS
you will be able to get this values and replace them. Also you need to replace theVIRTUALENV_PATH
value to match the correct python virtual environment directory path in your system and theSOURCES_PATH
to match the repository sources directory path also in your system :). -
With the previous step in place, now we can
enable
this new service into the systemd environment:$: sudo systemctl enable vpn_checker.service
-
And finally we can
start
thevpn_checker
service:$: sudo systemctl start vpn_checker
NOTE: Now, every time you start your computer, systemd
will automatically start the vpn_checker
service. So, if you want to stop the service manually, then you need to run sudo systemctl stop vpn_checker
.