I have these code in a file “code.py”
param_list = ['/usr/bin/someapp.bin','-q','/usr/bin/someparam.conf','/tmp/output.pdf']
p = subprocess.Popen( param_list , shell=False, stdout=subprocess.PIPE )
p.communicate()
the someapp.bin will produce a file and output as /tmp/output.pdf
when i run under the code.py under terminal shell , it works ,
and the user is : ubuntu
but when i try run it as a service using user : service_user
and make sure the /tmp folder is writable and accessible for anyone.
my question is why it just cannot generate as it suppose to be under
service , my suspect is permission issue but i just cannot get it to
work and need some advice and help , thanks.
The code should work. To track down the issue:
print(os.getuid())to the code to make sure it’s started with the UID that you expectsomeapp.binto see whether there is an errorPrint the output of the command to the console so you can see any errors: