(and then the control remains on the following path)
myUser@Servername1[pathto/home]
(have to print "exit" to get the output of echo statements and ctrl back to root@ServerName1
If the script really is "just a few echo statements and then an exit", then it's missing the leading shebang line and which shell runs it is up for grabs. Try putting in a shebang like #! /bin/bash or whatever is appropriate to your environment. Also, if it's that short, post it so we can see it.
I tend to think that the problem is elsewhere though. Try su - myUser -c "/bin/hostname" changing the path to where your hostname command resides. If that fails the script is exonerated and the problem probably lies with the login scripts for myUser.
#! /bin/bash
#
## Job name = JOB001
#
su - myUser -c "/apps/mtr/bin/GetStatus.sh"
exit $?
GetStatus.sh: This is run as myUser
#! /bin/bash
echo "Printing the Status"
#have to add some code but for debugging purpose presently just have echo statement
exit 0
---------- Post updated at 09:32 PM ---------- Previous update was at 09:09 PM ----------
Finally got it working by modifying the JOB001.sh
su - myUser<<! -c "/apps/mtr/bin/GetStatus.sh"
(am not sure what myUser<<! does but it works)
This was after searching the forum and found a reply(from user pchangba1) which worked.
(couldn't include the url because it requires to have atleast 5 posts to this site before one can post a url which i don't have as yet:p)