Python Forum
subprocess Popen not working via crontab
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
subprocess Popen not working via crontab
#3
(Mar-15-2017, 09:37 PM)Ofnuts Wrote: I assume things in crontab are executed with a very specific user and environment, and the PATH can be different from what you have in a plain user session. So for a start I would give the full path to the executable, but this could not be sufficient.

As an experiment, write a Python script that reports the executing user id, the working directory and dumps the environment variables and have it execute from crontab.

Thanks for reply Ofnust,

I was able to solve it yesterday but due to deadlines could not post an update.

You are right , the issue was because of an environment variable needed by oracle utilities.

below is the code which solved it.

session = Popen([r'/u01/app/oracle/product/11.2.0/db1/bin/dgmgrl','username/password@dbname','stop observer', '-logfile', '/u01/app/oracle/broker/fsfo_mydg.log'],stdout=PIPE, stderr=PIPE, env=dict(os.environ, ORACLE_HOME="/u01/app/oracle/product/11.2.0/db1"))
Regards,
Nitin
Reply


Messages In This Thread
RE: subprocess Popen not working via crontab - by nitin23c - Mar-16-2017, 10:06 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Understanding subprocess.Popen Pedroski55 6 547 May-12-2024, 10:46 AM
Last Post: Pedroski55
Information subprocess.Popen() suddenly giving me grief? davecotter 3 826 Dec-13-2023, 10:49 PM
Last Post: davecotter
  Use subprocess.Popen and time.sleep chucky831 2 2,072 Aug-11-2022, 07:53 PM
Last Post: carecavoador
  Architecture question for website with python crontab script rockie12us 1 1,832 Aug-09-2021, 10:07 AM
Last Post: Larz60+
  Subprocess.Popen() not working when reading file path from csv file herwin 13 16,205 May-07-2021, 03:26 PM
Last Post: herwin
  Did subprocess.Popen() causes main routine to pause stdout? liudr 4 3,836 May-04-2021, 08:58 PM
Last Post: liudr
  disable subprocess.popen prompt echo paul18fr 1 2,153 Feb-04-2021, 02:50 AM
Last Post: Larz60+
  how to pass the interactive string to Popen subprocess maiya 1 2,008 Sep-18-2020, 09:36 PM
Last Post: Larz60+
  How to get program output from subprocess.Popen? glestwid 1 2,483 Aug-19-2020, 05:44 AM
Last Post: buran
  python os.popen is not working for wait method elenaflorence87 0 2,089 Jul-22-2020, 12:56 PM
Last Post: elenaflorence87

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020