Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kintul opened this issue Apr 2, 2019 · 0 comments

Comments

@kintul
Copy link

kintul commented Apr 2, 2019

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant