wtfwinpc
Posts: 3
Joined: Fri Sep 13, 2019 8:05 am

Solved - Can't boot program on startup

Fri Sep 13, 2019 8:12 am

So I have a program called qbittorrent that I need to boot up when ever my raspberry pi 4 does a auto reboot.

Currently running on Raspbian Buster latest version.

Im a super noob and every single guide i could find on google for the past week has failed. :roll:
Last edited by wtfwinpc on Fri Sep 13, 2019 11:13 pm, edited 1 time in total.

jbudd
Posts: 961
Joined: Mon Dec 16, 2013 10:23 am

Re: Can't boot program on startup

Fri Sep 13, 2019 11:21 am

There are several different ways to start a program automatically.
Can you tell us what methods you have tried and what error messages you see?

ps What is "a auto reboot"?

User avatar
neilgl
Posts: 819
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: Can't boot program on startup

Fri Sep 13, 2019 11:50 am

Maybe use cron to set it running on a reboot. e.g. here I set my python program running when pi reboots:

Code: Select all

crontab -e
Add this at the end:

Code: Select all

@reboot python /home/pi/scripts/onoff.py &
save and exit
reboot

wtfwinpc
Posts: 3
Joined: Fri Sep 13, 2019 8:05 am

Re: Can't boot program on startup

Fri Sep 13, 2019 8:03 pm

neilgl wrote:
Fri Sep 13, 2019 11:50 am
Maybe use cron to set it running on a reboot. e.g. here I set my python program running when pi reboots:

Code: Select all

crontab -e
Add this at the end:

Code: Select all

@reboot python /home/pi/scripts/onoff.py &
save and exit
reboot
This will work for a gui application?

I currently don't have a /home/pi/scripts folder so if i make the onoff.py its going to be empty, what code do i put in it to tell it to load qbittorrent that's located in /usr/share/applications/qbittorrent.desktop or inside /usr/bin

jbudd wrote: There are several different ways to start a program automatically.
Can you tell us what methods you have tried and what error messages you see?

ps What is "a auto reboot"?
hard to remember all of the methods, most of them where for services before the gui, like rc.local, cron trying to load a sh file it wasn't tell a few days ago i realised i needed to start looking at lxsession but that's not working either. as for error messages I usually don't see anything since i just vpn into my pi to the desktop.

lastly the auto reboot is a script i have running that auto restarts the pi when ever it fails to ping 8.8.8.8, its strange but this pi isn't able to keep a constant internet connection without rebooting at least once or twice a day, i think its the vpn loseing connection but hard to say without testing it out in the future.

User avatar
neilgl
Posts: 819
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: Can't boot program on startup

Fri Sep 13, 2019 10:18 pm

Ah you did not say xxxtorrent was a GUI program - lets hope all torrents are legal... In that case, on a pi running stretch I did this to start a GUI program on boot:

Code: Select all

nano ~/.config/lxsession/LXDE-pi/autostart
edit that to start your torrent program. e.g. here I start chromium in kiosk mode (you don't want that):

Code: Select all

@chromium-browser --incognito --kiosk http://192.168.1.147/time.php
onoff.py is my python script to blink and LED - you dont need/want that.

wtfwinpc
Posts: 3
Joined: Fri Sep 13, 2019 8:05 am

Re: Can't boot program on startup

Fri Sep 13, 2019 10:42 pm

neilgl wrote:
Fri Sep 13, 2019 10:18 pm
Ah you did not say xxxtorrent was a GUI program - lets hope all torrents are legal... In that case, on a pi running stretch I did this to start a GUI program on boot:

Code: Select all

nano ~/.config/lxsession/LXDE-pi/autostart
edit that to start your torrent program. e.g. here I start chromium in kiosk mode (you don't want that):

Code: Select all

@chromium-browser --incognito --kiosk http://192.168.1.147/time.php
onoff.py is my python script to blink and LED - you dont need/want that.
this is super odd but for some reason its now working, for the past few days iv probably done these exact same steps and nothing worked but now it is so ah well, if it wasn't for you however i would of given up so thank you.

This rasbian has three lxsession locations but the correct one that worked for me is

Code: Select all

/etc/xdg/lxsession/LXDE-pi
the other location is /etc/xdg/lxsession/LXDE/ and /.config/lxsession/LXDE/autostart.
both of which don't do anything at all.

I then used @qbittorrent before @xscreensaver since i read that does matter from somewhere.

So the app loads up and looks ok but an extra window also pops up with a error I'm not sure if it matters yet or not tell the rss feed can pick something up. but the extra window thats opening at boot has

Code: Select all

i/o error the torrent file ' does not exist.
after a simple google search it seems the i/o problem is a bit more common, guess this thread could be marked as solved.

Return to “Beginners”