subprocess.Popen: does not return complete output , when run through crontab

Open
#9 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
20/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
python

Research direction

Start from the inline subprocess.Popen and communicate() example and reproduce the command under both a shell and crontab. Compare the cron environment and captured stdout/stderr; done means identifying the cause of the differing output and confirming complete capture in the cron run.

Written by the indexing model from the issue text.

Description

I am calling some java binary in unix environment wrapped inside python script

When I call script from bash, output comes clean and also being stored in desired variable , However when i run the same script from Cron, Output stored(in a Variable) is incomplete

my code:

command = '/opt/HP/BSM/PMDB/bin/abcAdminUtil -abort -streamId ETL_' \
          'SystemManagement_PA@Fact_SCOPE_OVPAGlobal'
proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, 
                       stderr=subprocess.PIPE)
(output, err) = proc.communicate() # Storing Output in output variable

Value of output variable when running from shell:

Abort cmd output:PID:8717
Executing abort function
hibernateConfigurationFile = /OBRHA/HPE-OBR/PMDB/lib/hibernate-core-4.3.8.Final.jar
Starting to Abort Stream ETL_SystemManagement_PA@Fact_SCOPE_OVPAGlobal
Aborting StreamETL_SystemManagement_PA@Fact_SCOPE_OVPAGlobal

Value of output variable when running from cron:

PID:830

It seems output after creating new process is not being stored into variable , i don't know why ?

Dominant language
Python
Stars
3
Forks
12
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from enthought/Python-2.7.3

All issues in enthought/Python-2.7.3

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.