Hello all.
I'm trying to get qbittorrent to run as a window from a script. If I type "qbittorrent" into terminal, it starts up. If I type "sudo pkill qbittorrent" it closes the app. The scripts are in /usr/local/bin/, and the timer/service files are in /etc/systemd/system. If I navigate to /usr/local/bin/ and type ./qb_start_test.sh and ./qb_kill_test.sh it also works.
This is just a test of concept for a few other things I want to do, but for this if I can get it to work in front of me I'll change the times to 0200-0800 because I have no download cap during those hours.
May I ask for some help to fine out why after enabling the service files, nothing works? x86_64 Linux 4.6.4-1-ARCH, bash 4.3.46.
qb_start_test.sh
#!/bin/sh
#qb_start_test
date >> "/home/will/Documents/backup_qb.log"
qbittorrent
qb_kill_test.sh
#!/bin/sh
#qb_kill_test
date >> "/home/will/Documents/backup_qb.log"
pkill qbittorrent
qb_start_test.timer
[Unit]
Description=qb_start_test
[Timer]
OnCalendar=*-*-* 02:00:00
Unit=qb_start_test.service
[Install]
WantedBy=multi-user.target
qb_kill_test.timer
[Unit]
Description=qb_start_test
[Timer]
OnCalendar=*-*-* 08:00:00
Unit=qb_kill_test.service
[Install]
WantedBy=multi-user.target
qb_start_test.service
[Unit]
Description=qb_start_test
[Service]
User=root
WorkingDirectory=/usr/local/bin/
Type=simple
ExecStart=qb_start_test.sh
[Install]
WantedBy=multi-user.target
qb_kill_test.service
[Unit]
Description=qb_kill_test
[Service]
User=root
WorkingDirectory=/usr/local/bin/
Type=simple
ExecStart=qb_kill_test.sh
[Install]
WantedBy=multi-user.target
Sort: Top
[–] Frenchgeek ago (edited ago)
I guess that's because you run it as root and not as the user currently using the GUI...
edit: https://ubuntuforums.org/archive/index.php/t-105250.html