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
#1
Hey All,

Okay , I'm gonna admit this issue has me completely stumped and i'm at my wits end.

Below is the code that has been troubling me and i have tried all the things i know or could have googled.

session = Popen(['dgmgrl','username/password@dbname','stop observer', '-logfile', '/u01/app/oracle/broker/fsfo_mydg.log'],stdout=PIPE, stderr=PIPE, cwd=r'/u01/app/oracle/product/11.2.0/db1/bin/')
output,error = session.communicate()
if session.returncode != 0:
    raise RuntimeError("broker command failed with %s stdout %r stderr %r" % (session.returncode, output, error))
else:
    print >> file, "The stdout is :\n %s" % output
    file.flush()
So while trying to execute above directly on the terminal , it executes perfectly , But it simply does not runs and throws below error when scheduled to run from crontab.

Error:
OSError >  2 OSError >  No such file or directory OSError >  None
or 

Error:
RuntimeError >  broker command failed with -11 stdout '' stderr '' Successfully sent email at 2017-03-15 09:32:10.226847
and i have tried all combinations of command formatting.

Please help.

Regards,
Nitin
Reply


Messages In This Thread
subprocess Popen not working via crontab - by nitin23c - Mar-15-2017, 01:58 PM

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,071 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