I would like to know how can I determine if a python script is executed from crontab?
I don't want a solution that will require adding a parameter because I want to be able to detect this even from an imported module (not the main script).
An easier workaround would be to pass a flag to the script only from the crontab, like --crontab, and then just check for that flag.
How can I determine if a python script is executed from crontab?