0

I wrote a python script and added it to the list of startup applications in Ubuntu. After restarting the device I can find that the script has not run and I don't know where to find the logs. What is the default location in which the logs will be stored?

I searched around similar questions such as this.I don't think this will apply for me as I am using a different method than the one mentioned in the question.

EDIT : I did not add my script in rc.local or as a cron job. In ubuntu dash if you type startup you will get a window asking you to add commands that you want to execute on startup. I added my script in that window.

  • How do you autostart your script - using /etc/rc.local or /etc/ini.d/script_name? – M. Dm. Jan 2 '18 at 12:12
  • @M.Dm. In ubuntu dash if you type startup you will get a window asking you to add commands that you want to execute on startup. I added my script in that window. – Nirmal Raj Jan 2 '18 at 12:53
  • Could you please edit your post, when you want to clarify something or add information? It’s best to have everything relevant in one place. Additionally, comments may be deleted for various reasons. Thanks. – David Foerster Jan 3 '18 at 9:35
  • What exact command did you add to the list of start-up applications? How exactly did you verify that the program didn't run? There is no log file location for applications that aren't set up to generate them. – David Foerster Jan 3 '18 at 9:38
  • @DavidFoerster I added python3 ...\main.py to the list and if the program ran it is supposed to show a notification but I didn't get any. You can see my code here.github.com/RajNirmal/Python_Remainder/blob/master/main.py. I added a couple of print() lines in there but haven't updated the repo yet. The output of the print() function should be stored somewhere right? – Nirmal Raj Jan 3 '18 at 9:40
1

After you added your python script to startup applications, a new '.desktop' file - corresponding to your script - have appeared in ~/.config/autostart That file contains a line saying: Exec=your_script.py

A simple workaround would be to change in the .desktop file your_script.py to wrapper.sh, where wrapper.sh would be a new script simply reading: python your_script.py > your_log.txt

Then, obviously, the output of your_script.py will appear in your_log.txt.

P.S. I would have added this workaround as a comment rather, than a solution, which I cannot do as a newly registered user. Sorry about that, hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.