another_mikey
Posts: 3
Joined: Sun Jul 22, 2012 6:18 pm

Running A Program When openbox loads

Sun Jul 22, 2012 6:47 pm

I am not a sophisticated Linux user, being a Windows programmer by trade. But I have had great fun (up to now) working with my Raspberry Pi. I originally had been using the recommended 'squeeze install but I now have loaded up he new (as of yesterday) Raspbian image and have things about set up. My system is configured to autologin and boot into X. The last thing is to start an application after X is running. I had this working in squeeze after much pain and gnashing. But can't get it to work in the new Raspbian image. I have tried a couple approaches. The current one is referenced here:

http://crunchbanglinux.org/wiki/howto/a ... t_programs

and seemed very clear on how to implement. The approach is using an autostart file inside the openbox folder inside of ,config, as in :

/home/pi/.config/openbox/autostart

That file attempts to run a script in my home directory called show_Kewl_Pix.sh. The autostart file looks like this:

Code: Select all

# Programs that will run after Openbox has started

# Run my digital picture frame script
(sleep 5s && /home/pi/show_Kewl_Pix) &
The show_Kewl_Pix.sh script looks like this:

Code: Select all

#!/bin/sh
feh -z -F -D 20.0 -Y /media/HP\ v125w/Kewl
This is supposed to run the feh image viewer at startup creating a large digital picture frame. The script runs fine is invoked from a terminal window after X has loaded up and the desktop is visible.

I have previously also tried setting up a .desktop file in the .config/autostart directory using this format:

Code: Select all

[Desktop Entry]
Type=Application
Exec=/home/pi/show_Kewl_Pix.sh &
which I think is what worked ok in the previous squeeze install, with no luck either. I have seen numerous other references to these and other proposed solutions that I cannot get to work.

Is this really that hard, am I just missing something obvious, or is there yet some other magic incantation approach I haven't found yet to make this work? Aaaacccck! Help!

MIke L.

dukla2000
Posts: 190
Joined: Tue Jan 10, 2012 12:02 am
Location: Reading.UK.EU

Re: Running A Program When openbox loads

Sun Jul 22, 2012 9:07 pm

another_mikey wrote:The approach is using an autostart file inside the openbox folder inside of ,config, as in :
/home/pi/.config/openbox/autostart
Works fine for me on the recent 'Foundation Raspbian image, although I run programs not scripts. My ~/.config/openbox/autostart is

Code: Select all

# Start gkrellm
gkrellm &
On the original Pisces image this did not work for me - never got it debugged Knew I was on the correct track though as also use Openbox on my main (now server!) PC and have a few more bits in the autostart there.
Daily driver: Pi3B, 64GB Samsung Evo+ @100MHz, DVB-T, onboard WiFi for internet, BT/USB dongle for KB/mouse, 250GB HDD via USB for media, Raspbian Jessie Lite with Openbox desktop.
Museum: Pi B

another_mikey
Posts: 3
Joined: Sun Jul 22, 2012 6:18 pm

Re: Running A Program When openbox loads

Sun Jul 22, 2012 9:44 pm

dukla2000,

Thanks for the response :) I tried changing my autostart file to have the direct invocation of the application like this:

Code: Select all

# Run the digital picture frame script on startup
feh -z -F -D 20.0 -Y /media/1CE7-7DE2/Kewl &
I tried changing the USB flash drive where the pictures are located, which is why that looks different than my original post. In any case, this still doesn't work. Are there any other lines in the autostart file? Is it supposed to be configured as a shell script with a #!/bin/sh at the beginning? Does it need to be executable? man, this is just driving me crazy...

ML

tkerbavaz
Posts: 4
Joined: Sat Jul 28, 2012 4:18 am

Re: Running A Program When openbox loads

Mon Jul 30, 2012 5:08 am

I'm having the same problem. Trying to execute a python script on startup.

This is what I've got:

/home/pi/.config/openbox/autostart.sh

Code: Select all

#!/bin/sh

#start screenly
(sleep 3s && python /home/pi/screenly/viewer.py) &
But it's not running. Harumph.

mazadillon
Posts: 3
Joined: Tue Jul 31, 2012 4:05 pm

Re: Running A Program When openbox loads

Tue Jul 31, 2012 4:07 pm

I edited /etc/xdg/lxsession/LXDE/autostart

and added my command in and it worked fine, no need to do the sleep part.

dukla2000
Posts: 190
Joined: Tue Jan 10, 2012 12:02 am
Location: Reading.UK.EU

Re: Running A Program When openbox loads

Tue Jul 31, 2012 11:42 pm

another_mikey wrote:Are there any other lines in the autostart file?
Nope, that's my entire file. I can't think of anything clever I did on my pi to get this to work after the Foundation Raspbian install. Not sure what to suggest - maybe start your script as a parameter to an xterm?
Daily driver: Pi3B, 64GB Samsung Evo+ @100MHz, DVB-T, onboard WiFi for internet, BT/USB dongle for KB/mouse, 250GB HDD via USB for media, Raspbian Jessie Lite with Openbox desktop.
Museum: Pi B

arno
Posts: 1
Joined: Sun Oct 28, 2012 1:57 pm
Location: NL

Re: Running A Program When openbox loads

Sun Oct 28, 2012 2:07 pm

@another_mikey
I had the same problems and struggled with it all day. I could autostart applications, but not the script.
My script also calls feh to do a slideshow. (I tried both the .desktop and autostart file)
It finally dawned on me. The picture files were located on another partition of the SD card. It is (auto)mounted on /media/RASPI-MEDIA. When I tried with some picture files in /home/pi everything worked fine. Apparently this partion was not mounted yet when lxde autostarts the script.
Probably the same thing happens since your files are on a mounted USB stick.

//Arno

timatron
Posts: 1
Joined: Thu Nov 08, 2012 12:00 am

Re: Running A Program When openbox loads

Thu Nov 08, 2012 12:02 am

This is driving me crazy!!!! I cant get it to autostart anything in any of the above configurations. Using latest raspian image.

exy
Posts: 1
Joined: Wed May 01, 2013 1:23 pm

Re: Running A Program When openbox loads

Wed May 01, 2013 1:26 pm

I'm a Pi noob and just come across this post in my search to get Synergy to successfully start with the GUI.

Just want to say thanks for helping, as it now works perfectly.

r10
Posts: 1
Joined: Wed Mar 28, 2018 11:06 pm

Re: Running A Program When openbox loads

Wed Mar 28, 2018 11:10 pm

I had this problem.
It turned out that I had set my ~/.xinitrc to 'openbox'. It has to be 'openbox-session', which will run all the scripts in addition to launching openbox itself.

Return to “Troubleshooting”