Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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!
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.