I am trying to get a simple Python script running on startup with Cron on Ubuntu 16.04. What I did is opened cron with:
sudo crontab -e
I even tried
@reboot without sudo later.
Then I do:
But when Ubuntu starts the Python file seems to have not run. I also modified crontab by opening it as a simple user:
@reboot sudo python /my_script_path
The Python script is supposed to create a text file when executed. I have tested the Python script using the terminal and it successfully generates that text file.
Anyone know what I am missing here?
Edits: The Python script I am trying is a very simple one:
with open("example.txt", 'w') as file: file.write("Some text") print("Done")