0

I have a python script (script A) that runs multiple sub-processes (running another python script - script B). When I run the script manually, it works fine, but when it is being run using crontab it behaves differently. To be more specific, my script is limited to 100TB of quota, so script B runs over a tree and produce a text file of size-per-dir. This script is being run multiple times on several dir-trees as a subprocess, and the results are being further analyzed by script A. When I run manually, both scripts run fine. But when I run it using Cron, script A runs fine but script B produce odd resutls. Any ideas of why using Cron would affect a python script?

Elad Edri
  • 321
  • 2
  • 6
  • crontab uses a stripped down environment, and a limited path. That means that: 1/ command may not be found if they are not prepended with their full path 2/ programs finding elements in the environment may not find them. More details in [that other post](https://stackoverflow.com/q/2229825/3545273) – Serge Ballesta May 29 '18 at 09:18

1 Answers1

0

Make sure the crontab you are using is with full path of the .sh file.

And in beginning of your script try to add the following:

. /home/gemapp/.bash_profile

to load all needed items in bash_profile.

Ivan Vinogradov
  • 3,611
  • 6
  • 27
  • 29
pedram ezzati
  • 321
  • 3
  • 13