0

I've got a python Bottle program which uses Bottles own internal dev server and I'm trying to get it to start up automatically in Lubuntu. I created a bash script like this:

nohup python /home/user/mybottle/mybottle.py &
sleep 5
firefox &
sleep 5
xdotool key "F11"

I've set the script executable and if I run it directly from the terminal the script works fine (some gtk critical messages fromFirefox but it still seems to work). If I call this script in ~/.config/lxsession/Lubuntu/autostart with this:

/home/user/mybottle/mystartupscript.sh

and reboot the machine the Bottle program doesn't seem to start, Firefox does, but then won't go to fullscreen with xdotool and obviously Firefox can't find my program running on localhost. There is no python entry when checking top either so quite sure the python program isn't running.

I've tried starting it with crontab, rc.local and a .conf in /etc/init as well as separating the python script off and nothing will getting it going and leaving it running in the background. I'm not really sure where I'm looking for an error log for these different methods either as any of the logs I've tried looking at don't make any mention of the script.

As a last ditch attempt I tried the .desktop method mentioned in other threads but that isn't working either. Removing nohup makes no difference.

How do I get my python program running on startup? Lubuntu is set to login automatically without needing the password input.

  • I am pretty sure timing is the issue. You need to make the script smart and check if bottle runs succesfully before proceeding, and similarly make it smart to wait for for the firefox window to run the keypress (if that is what you want to use). With the latter I can help you out, but I am not sure how to check for bottle script to run successfully and is ready to proceed? The pid is probably not sufficient. Do you have a test to check that? if so, we can make it work for sure. – Jacob Vlijm Apr 5 '17 at 11:21
  • @Jacob, thank you, timing was the problem but not where I expected. Regardless of which script method I used the script was running before the network device had started. Even though there was no physical network connection the networking needed to start to assign localhost for the Bottle server. It took a fair amount of hunting through old Upstart threads but finally got there, thank you. – user673708 Apr 5 '17 at 19:52
  • No problem, thanks for mentioning. maybe you can add an answer? – Jacob Vlijm Apr 5 '17 at 19:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy