Code: Select all
su - pi -c kodi
Code: Select all
./home/pi/myprogram/viewdata
Just precede it with sudoTrianP wrote: But it's still an interesting question: is there a way to insert a python script that needs sudo rights into the autostart file? I'd like to know for future projects even if not for this one.
Thanks!
Code: Select all
@sudo python /path/to/script/something.py
probably because you have done it worngreltek wrote:Sadly none of the suggested answers helped. The only way I was able to get my program to run at boot with correct work path folder is writing a mini program, which runs at boot, started myprogram.
Code: Select all
su - pi -c kodi
Code: Select all
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
su - pi -c kodi
exit 0
Code: Select all
/home/pi/.config/lxsession/LXDE-pi/autostart
Code: Select all
sudo nano /home/pi/.config/lxsession/LXDE-pi/autostart
Try:raspisnagger wrote: ↑Wed Jan 24, 2018 2:52 pmI wrote "@sudo /usr/bin/python /home/pi/Desktop/Filename.py" but on startup nothing happens. Where did I go wrong? We know the path works when executed through the console.
Code: Select all
@lxterminal -e python /home/pi/Desktop/Filename.py
Code: Select all
nano /home/pi/.config/lxsession/LXDE-pi/autostart
There is no restart in the menu, and the restaporeg wrote: ↑Fri Jun 16, 2017 2:18 pmFirst of all Hello to all
Thanks @TheRadziu
This worked for meThis is how is should look like after editCode: Select all
su - pi -c kodi
Code: Select all
# Print the IP address _IP=$(hostname -I) || true if [ "$_IP" ]; then printf "My IP address is %s\n" "$_IP" fi su - pi -c kodi exit 0
Users browsing this forum: stubright and 11 guests