Re: Simple shell question



The carbonbased lifeform Michael Soibelman inspired alt.os.linux.suse with:
I don't write shell commands very often and I'm sure this should be quite
simple. I'm trying to write a script to start my J2EE server so I don't
have to do it manually. In case you are wondering I'm just doing it for
fun now and maybe I'll write a java application soon. I have NetBeans for
that. Here's what I do manually.

1. cd to the directory where the application launcher is
(/home/mike/SDK/bin)
2. su
3. password
4. (run this command) ./asadmin start-domain domain1


That's it. Simple. So what are the exact lines so I can copy and paste in
my editor (nedit) ??

"exact lines" ?? You want cookies with that too?

#v+
#!/usr/bin/env expect

cd /home/mike/SDK/bin
spawn su - mike
expect "Password: "
send "xxxxx\n"
expect -re "^(.*)# " #insert Prompt here
send "./asadmin start-domain domain1\n"
interact
#v-

Not tested of course

Theo
--
theo at van-werkhoven.nl ICQ:277217131 SuSE Linux
linuxcounter.org: 99872 Jabber:muadib at jabber.xs4all.nl AMD XP3000+ 1024MB
"ik _heb_ niets tegen Microsoft, ik heb iets tegen
de uitwassen *van* Microsoft"
.



Relevant Pages

  • Re: Reading a text file
    ... What is the exact look of the date in Excel, ... Better to bite the bullet and have the script leverage EXCEL to extract the ... manually exporting a csv file. ... back into the spread sheet as to when it sent the email notification. ...
    (microsoft.public.scripting.wsh)
  • Need Help with Call Shell("cmd /K netstat") Function!!!
    ... I have found a better solution using a script based FTP ... using the Command Prompt the "Call Shell" function to be exact. ... however come into a problem with using the Call Shell function. ...
    (microsoft.public.excel.programming)
  • Re: Remove and Add Printer Script
    ... Then rerun the script. ... It will crash at the exact ... turn error checking back on ... I tried that and I get the same exact result. ...
    (microsoft.public.scripting.vbscript)
  • Re: Help Please..Generic Error.Runing Script to remote computer
    ... Second you need to write a new script that merely grabs software from a target system and prints it on screen, then run it against a good system, and then a bad system. ... Forget all the surrounding script and the database stuff, ... Post the exact code back here with the exact line number and exact error, ... I thought it would be a firewall issue, i have checked all of the firewall settings via group policy and it is not turned on. ...
    (microsoft.public.win32.programmer.wmi)
  • Re: bad gnome-terminal or bad script?
    ... >> I just tried the same script with telnet instead of SSH. ... The exact same ... >> from a console, it behaves beautifully with none of the bad behavior I ...
    (Fedora)