I've got a startup/stop script provided for Tivoli Workload Scheduler in which it will start/stp[ the TWS services in IBM i.
# CHECK ROOT USER
WHO=`id | cut -f1 -d" "`
if [ "$WHO" = "uid=0(root)" ]
then
su TWSSVC -c "/etc/rc.d/init.d/tebctl-tws_cpa_agent_TWSSVC stop"
exit $?
fi
/etc/rc.d/init.d/tebctl-tws_cpa_agent_TWSSVC stop
exit $?
Problem with this is that, in OS/400 the equivalent of root is QSECOFR, so I've amended the line
if [ "$WHO" = "uid=0(root)" ]
to
if [ "$WHO" = "uid=0(QSECOFR)" ]
then i got an error on the following line:
su TWSSVC -c "/etc/rc.d/init.d/tebctl-tws_cpa_agent_TWSSVC stop"
/TWSSVC/TWS/ShutDownLwa: 001-0019 Error found searching for command su. No such path or directory.
How do I change to script such that, when it is QSECOFR, it will su into TWSSVC and trigger the start/stop script? I'm not very familiar with OS400. I'm triggering this script in qsh environment.
you can try the following;
Tell me how it goes.