LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-17-2008, 01:03 AM   #1
mijohnst
Member
 
Registered: Nov 2003
Location: Huntsville, AL
Distribution: RHEL, Solaris, OSX, SuSE
Posts: 419

Rep: Reputation: 31
Scripts stops


I've just written a very simple script to rsh to about 50 of my clients and run another script to stop and restart a service... The problem is that the service starts a java daemon and although I'm putting it in the background it doesn't come back to a prompt and wants me to hit enter. After I hit enter then the prompt comes back. That's fine if I log into the machine manually and start the service, but with my rsh script, it hangs on the first line because it's waiting for an enter.

How do I make my script ignore any output so it'll go to the next line? This is an example of what I'm using.

Code:
### /etc/rc2.d/S99myscript
#!/bin/bash
cd /usr/local/bin
nohup ./java myjavaapp.js &
This is very simplistic. I have stop, start and restart but what I have above is basically the line I'm trying to run. Thanks for the help!

Last edited by mijohnst; 11-17-2008 at 01:04 AM.
 
Old 11-17-2008, 04:59 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
1. *.js is usually javascript code, not JAVA
2. if its your own code you can fix it internally
3. if its closed src, try the Expect utility, its designed to automatically handle progs that expect human interaction.
 
Old 11-17-2008, 08:35 AM   #3
mijohnst
Member
 
Registered: Nov 2003
Location: Huntsville, AL
Distribution: RHEL, Solaris, OSX, SuSE
Posts: 419

Original Poster
Rep: Reputation: 31
Thanks for the input! Actually, there is no file extension on my daemon process. I just used *.js to illustrate it was a file. Bad choice I guess... lol Unfortunately it's not my code other so I can't change it. I also neglected to say that these are Solaris systems, but I'm thinking that my problem should be independent of it's Unix type. I just thought that there was a way that you can make a command run and not wait for anything return.
 
Old 11-17-2008, 09:02 AM   #4
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Using nohup with a & at the end should work. If it's not, then it's the Java application itself after testing my own commands with nohup with an & at the end, it came back to the prompt. Time to go talk to the developers I'd say.
 
Old 11-17-2008, 09:23 AM   #5
mijohnst
Member
 
Registered: Nov 2003
Location: Huntsville, AL
Distribution: RHEL, Solaris, OSX, SuSE
Posts: 419

Original Poster
Rep: Reputation: 31
Thanks for the input Trickykid... I think you're right... lol
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mencoder stops before it finishes - stops around 4% - all dvd's dthims Linux - Software 1 09-11-2008 05:25 PM
a start up script in rc.M stops the following scripts from running nass Slackware 7 05-21-2007 06:21 AM
VPN: Debian Scripts -> Mandriva 2006 Scripts Undefined Mandriva 0 11-30-2005 12:10 PM
VNC Works then stops! Reboot fixes but then it stops again! Leethal Linux - Software 1 02-26-2004 07:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration