Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calling external programs from inside a shell script

Status
Not open for further replies.

desibhai

Programmer
Sep 25, 2002
5
AU
I am trying to run sudo and other MQSERIES related commands from inside a shell script. But I am not moving forward with script executing the first command and stopping.

#!/usr/bin/ksh

sudo su - mylogin # My script comes to this command and after executing it, stops there

external command1 # these commands are application related (like websphere startup)

external command2 # this command is calling MQSERIES and running some query on it.

As I said, I want my script to take all these commands and run without any manual instructions.

Can some one help me...

 
Based on what you have here, I am gathering that you want to su to your login to run this? Are you running as root then? Why not just make this a startup file in /etc/rc.d and set the permissions to 755+s and ownership root:root or root:sys? This should be able to start everything without any problems since you are effectivily root and you can take out the sudo part in the script since it is no longer needed.
 
Actually, I want to run not only sudo but some other
commands too from my script, And after executing all
these commands I want to come back into my script and
do further few things. To sum, I need to run a no of
commands (not unix, but some application oriented) and
logging as different users from inside my script.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top