genericpurpleturtle
Posts: 3
Joined: Fri Jul 18, 2014 1:50 pm

Unable to run script on startup

Mon Jul 21, 2014 12:21 pm

I've been trying to get a libre impress presentation to start on start up and I've been failing horribly. I had a simple 2 line script working that I put in the /home/pi/.config/lxession/LXDE/autostart directory which was working but then when I modified it to be more complicated it stopped running and when I changed it back it still didn't work. I've reinstalled the OS and tried again with the simple 2 line script and it still wont run. I've also tried adding lines to /etc/rc.local and that doesn't work either. I've tried putting the location of the autostart script in there and i've tried just the shell commands niether run on startup. Both the autostart script and the rc.local script work fine when called from the terminal but don't run on startup. I am completely lost, I've changed the permissions on both files to 755 to be executable and I then also tried 777 and that didn't work either. I literally have no idea what I'm doing wrong any help would be very much appreciated.

This is the simplified script that I'm trying to run

Code: Select all

sudp rm -f /var/www.lock.slideshow.odp#
sudo libreoffice -show /var/www/slideshow.odp --norestore &
This is the code I would like to run in the completed project that checks to see if a new slideshow has been uploaded to the server, if it has the test file exists and it closes the powerpoint waits then reopens it

Code: Select all

sudp rm -f /var/www.lock.slideshow.odp#
sudo libreoffice -show /var/www/slideshow.odp --norestore &
for (( ; ; ))
do
if [ ! -e /var/www/test.txt ]
then
sleep 1
else
pkilloffice.bin
sleep 3
sudp rm -f /var/www.lock.slideshow.odp#
sudo libreoffice -show /var/www/slideshow.odp --norestore &

User avatar
kusti8
Posts: 3439
Joined: Sat Dec 21, 2013 5:29 pm
Location: USA

Re: Unable to run script on startup

Mon Jul 21, 2014 2:28 pm

Try putting it in /etc/xdg/lxsession/LXDE/autostart instead like this:

Code: Select all

@sh script.sh
There are 10 types of people: those who understand binary and those who don't.

genericpurpleturtle
Posts: 3
Joined: Fri Jul 18, 2014 1:50 pm

Re: Unable to run script on startup

Mon Jul 21, 2014 3:05 pm

kusti8 wrote:Try putting it in /etc/xdg/lxsession/LXDE/autostart instead like this:

Code: Select all

@sh script.sh
What exactly do you mean by the script.sh bit?

Should that be a path to the script saved with a .sh extension?

Edit: I tried that with the script saved in /var/www/script.sh and added @sh /var/www/script.sh to the file and it didn't work :(

Edit 2: yes it did, there was a type in the address that I didn't spot:)

User avatar
pluggy
Posts: 3635
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
Contact: Website

Re: Unable to run script on startup

Mon Jul 21, 2014 3:22 pm

Try putting

Code: Select all

#!/bin/bash
at the start of the script, so the OS knows what kind of script it is.
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......

DirkS
Posts: 10363
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Unable to run script on startup

Mon Jul 21, 2014 7:31 pm

Code: Select all

sudp rm -f /var/www.lock.slideshow.odp#
No help for your problem (since the script essentially works from a terminal) but I assume that 'sudp' should be 'sudo'...

Gr.
Dirk

Return to “Troubleshooting”