I have a long running process that was parsing text and my laptop died at some point because it was unplugged.

I really don't want to unnecessarily run the process again because it takes over a day, but I need to see if the process finished or not before the computer died. Is there any way to do this?

It was a python script

closed as unclear what you're asking by muru, Thomas Ward, Pilot6, David Foerster, user117103 Dec 14 '15 at 15:30

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    How can anyone guess without knowing what the command does? And you say bash command in the title and python script in the question. Which is it? – muru Dec 14 '15 at 0:23

Not knowing what the script or command is/was makes it harder for me to answer, but as a general rule: If nothing outstanding enough to force the Operating System to log it happened, it's pretty much lost, as far as I know.

Good software developing practices involves writing "Debug" code, which will allow the program to leave messages about its own progress somewhere, either in a text file, or in /var/log/yourscriptname/last.log as example.

If your script contains such debugging code, those two links might be of use to you:

If there is nothing to be found, I would recommend reading the script to see if it contains debugging code, and if none is present, add something equivalent to Script finished at [time here] where needed.

  • I took so long to do the research on this that I was the last to answer, haha... – Xenhat Dec 14 '15 at 0:46

Typically, commands won't return a status code if they've been unexpectedly shut down, especially in the case of a power loss.

The best thing you can do is to see if the output (file or whatever) is there. If it is, then your process probably finished (or finished partially). If not, you're going to have to restart your task.

If this is your own code, I would highly suggest that you attach a debugger to your program. If it's someone else's and it's open source (it's Python so it should be), you can just add it in.

  • ok, it outputs a ton of files so I guess I will probably have to start it again, ouch – deltaskelta Dec 14 '15 at 0:32
  • @deltaskelta I know, it's always annoying. Once bitten, twice shy. – Kaz Wolfe Dec 14 '15 at 0:33

There's no general way to check if a given program was running when the system was shut down or died.

Depending on your program you may guess e.g. on the modification date of soem output files. If you want to be sure you should rerun the program.

If possible you probably could add some logging to the program so you know next time if it finished properly.

  • Aah! You beat me to it! :) – Xenhat Dec 14 '15 at 0:43

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