I can use below script to run from root user..
su - db2inst1 -c 'db2start && \
(sh -x [login to view URL] test1 test2 || exit 0)'
But I want to execute above script in 2 steps..
1. su - db2inst1 ( which help to login )
2. need to execute( -c 'db2start && (sh -x [login to view URL] test1 test2 || exit 0) ) after execute 1st command.
Hi There
I know your scenario exactly. but the best and safety way is using non-root user to run the script.
I can help to execute the sub command in the bash with non root user
let's have a chat if you need more details
Thanks
the script will look like this:
if su - db2inst1 ; then
-c 'db2start && (sh -x test1 test2 || exit 0)
else
echo "Command failed"
fi
--------------------------------------------------------------
if I helped you, just give me the project, tks