Answers for "run multiple scprits with bash"

2

python execute shell command and get output

import subprocess
process = subprocess.Popen(['echo', 'More output'],
                     stdout=subprocess.PIPE, 
                     stderr=subprocess.PIPE)
stdout, stderr = process.communicate()
stdout, stderr
Posted by: Guest on March-07-2020
0

run specific script with an other user linux

/bin/su -c "/path/to/backup_db.sh /tmp/test" - postgres

Breaking it down:
 /bin/su : switch user
 -c "/path/to..." : command to run
 - : option to su, make it a login session (source profile for the user)
 postgres : user to become
Posted by: Guest on March-24-2020

Python Answers by Framework

Browse Popular Code Answers by Language