Reputation: 21
I have a python scripts (Duploadr.py) that runs continues, basically it monitors the folder for any changes. And I have a tkinter program (tk.py).
I need to run both after Raspberry pi in a GUI interface.
the first script need to be run under a certain folder so I have to cd /foldername/Duploadr.py before I executed
All files have execute and all using chmod.
not I create a file called launcher.sh and addeded to
sudo nano /home/pi/.config/lxsession/LXDE-pi/autostart
I added this to the bottom
@sh /home/pi/launcher.sh
in launcher.sh
#!/bin/sh
sudo python3 /home/pi/Desktop/tk.py
cd /home/pi/Flickr/
sudo python /home/pi/Flickr/Duploadr.py -d &
what is happening the launcher is executing fine, but it is only execute the first script and it ignores the second one.
I tried to change the sequence but no matter what I do, it does not execute the second sudo.
when I do
ps -aux | grep python root 1148 0.2 0.4 7232 3368 ? S 10:52 0:00 sudo python3 /home/pi/Desktop/tk.py root 1156 15.3 3.0 40280 23588 ? Sl 10:52 0:01 python3 /home/pi/Desktop/tk.py pi 1291 0.0 0.0 4376 548 pts/0 S+ 10:52 0:00 grep --color=auto python
I do not see the second one.
Thank you.
Upvotes: 1
Views: 2200
Reputation: 1518
Just append &
to the end of your first command, like so:
sudo python3 /home/pi/Desktop/tk.py &
Upvotes: 1