I use 17.04 and rc.local is gone(I couldn't do it with rc.local anyway).
I just want this two commands to run at the startup;
cd Folder
python3 file.py
That's it. I looked all the similar answers here but I couldn't make it.
Thank you so much!
I use 17.04 and rc.local is gone(I couldn't do it with rc.local anyway).
I just want this two commands to run at the startup;
cd Folder
python3 file.py
That's it. I looked all the similar answers here but I couldn't make it.
Thank you so much!
Not using 17.04, but under 16.04 there is a "Startup and Shutdown" item in "System Settings". There is an "Autostart" item under there that allows you to specify scripts or programs that you want to run at startup.
You can use a cronjob.
Edit your cronjobs with crontab -e
, and add the script to run
@reboot /home/user/script.sh
as an example
It is best to use a full path to your script
chmod +x /home/user/script.sh
Then try running /home/user/script.sh from the terminal and see if you get the desired result.
– amanusk Oct 15 '17 at 18:51Folder
.#!/usr/bin/python3
. Or wherever you have python3.chomd +x
to make the script executable.
Then try running your script. Just /home/usr/script.py
without python3 at the beginning.
If the script MUST run from the directory Folder, you can try changing it to use full paths as well
– amanusk
Oct 15 '17 at 19:05
python3 path/to/file.py
instead – doesn't just running it as an autostart application in the settings suffice? – dessert Oct 15 '17 at 17:42