Python Forum
run python script on startup?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
run python script on startup?
#1
Hello ,
I have create a python code that wait for a press of a button then send a UDP
the code is running without any problem when I run it from the cmd.
but when I try to make it run on boot - it doesn't even start
any idea why?

his is what I did :
in the /etc/rc.local


'/home/pi/Documents/starup.sh'
'exit 0'  
and the the startup.sh is

#!/bin/sh
sleep 30
python /home/pi/mu_code/MyProgram/PressButtonShowMsg.py
Reply
#2
Try to use Cron,then can call Python file directly without using shell script.
sudo crontab -e
Add:
@reboot python /home/pi/mu_code/MyProgram/PressButtonShowMsg.py &
Restart sudo reboot
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Using Autostart to run a GUI program at startup. Rpi Edward_ 1 577 Oct-28-2023, 03:19 PM
Last Post: SpongeB0B
  Is there a *.bat DOS batch script to *.py Python Script converter? pstein 3 3,009 Jun-29-2023, 11:57 AM
Last Post: gologica
  how to startup canbus interface on pi korenron 2 2,184 Oct-24-2021, 09:51 PM
Last Post: DeaD_EyE
  pexpect startup help korenron 2 3,433 Apr-27-2021, 07:23 AM
Last Post: korenron
  Error when running script on startup in Linux NoahTheNerd 0 1,926 Mar-07-2021, 04:54 PM
Last Post: NoahTheNerd
  Run script on startup in Debian with systemd? MrGlasspoole 5 3,574 Jul-12-2020, 11:48 AM
Last Post: MrGlasspoole
  How to kill a bash script running as root from a python script? jc_lafleur 4 5,792 Jun-26-2020, 10:50 PM
Last Post: jc_lafleur
  crontab on RHEL7 not calling python script wrapped in shell script benthomson 1 2,248 May-28-2020, 05:27 PM
Last Post: micseydel
  Package python script which has different libraries as a single executable or script tej7gandhi 1 2,583 May-11-2019, 08:12 PM
Last Post: keames
  Python script runs on startup but does not register keystrokes. mericanpi 3 3,380 Sep-07-2018, 02:58 PM
Last Post: mericanpi

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020