Pradeep Murthy:
Hi guys, how to switch user in ubuntu and exec cmds as that user in sh step of Jenkins pipeline.? I am getting this error because psql is executed as root
script {
sh ‘’’
su - postgres psql -c “CREATE USER myuser WITH PASSWORD ‘mypassword’;”
‘’’
}
su - postgres psql -c CREATE USER myuser WITH PASSWORD 'mypassword';
psql: line 1: CREATE: command not found