0

I ran a python script overnight, and it was already done when I checked the code in the morning.

Is there a time log stored somewhere of when the python script finished executing? Or maybe a log of the subprocesses running on the system that would give me the time when the script finished running? Or a terminal history? Is there a way to do this, without having to include a time logger in the script itself?

I am running my code on an Ubuntu 18.04 PC.

Sashank
  • 107
  • 2
  • 11

1 Answers1

0

I don't know if Ubuntu automatically logs your script, but you can always use datetime with print, which is an easy way of knowing when it starts of finishes. Here's a link

  • Yes, I know that I can use Datetime. The question was if there was a way to do it without writing something in the script. – Sashank Apr 07 '22 at 17:42
  • When calling the script, try using time nameOfScript.sh, it should give you the completion time of the whole script. – Léo Langevin-Gascon Apr 07 '22 at 18:00
  • Yes I know that! My question was related to logging after the process/script has finished running. How would you find out when the particular script ended? I've been looking at syslogs, but it doesn't seem to show it. To be more clear, I want to know if there is a log file for all system processes, and if there is what file is it? – Sashank Apr 07 '22 at 18:15
  • In that case, no there isn't one for scripts. You will need to manually setup timestamp, datetime etc. Sorry for the confusion! – Léo Langevin-Gascon Apr 07 '22 at 20:47