I'm using a ssh session on a Linux server to start an Embedded Jetty Server to run a web application that exposes web services. When I use the java -jar start.jar to bring up the Jetty web server instance I don't have access to the command line in that session and must open up a new ssh session in order to run a command line application that invokes the web services running on the jetty instance. Is there any way to run jetty in the background and in the same ssh session have access to the command line?
look at nohup, and as I recommended on the mailing list when you asked this same question, get to know the 'screen' utility, it is a wonderful tool to have in your toolbox.
Related
I'm using Amazon EC2 to host my Node.js server. I connect through ssh from my desktop, and once I run my server via ssh, I can turn my console off and everything will still work, obviously, since the process is running on my remote EC2 hosting server. But once I ssh again, I know the Node process is still running, but there seems to be no way to view the process logs, and this server is still in early beta versions that the console logs are important. Any help?
You could redirect stdout/stderr to a file, which would allow you to use ordinary tools like cat and tail to view the logs.
If you don't want to write the log output to file(s), you could start the process in screen or tmux or similar and attach to the session later from ssh.
I would like to draft a browser application which can connect to ~20 remote sshd. Per ssh connection multiple commands should be handled. After restarting the browser, the several running jobs should be displayed in the browser again.
How would you construct the application ? The application should run on a Raspberry Pi. So utilization is limited.
Check the wikepedia page for web based SSH. The basic idea is to have JavaScript on client to submit commands to server side web application. And server side application will connect to several different server sshd as proxy to send command and receive output.
Personally I will suggest to use WebSocket to implement the communication between client and server. But not sure what's the OS you will have and what library and programming language will be handy for you.
I am using derby on a remote Ubuntu 12.04 server. The standard derby commands are all working correctly and I am able to open my databases and access them via ij. I need to be able to start and stop the server from the terminal while logging in and out between commands. The problem is that I can not find a way to run the server as a background process. The closest I have come is: nohup java -jar $DERBY_HOME/lib/derbyrun.jar server start & > ~/dblog.txt which works except that it requires I hit [enter] before returning to the command line. I am aware of the daemon package but I am uncertain of whether it will allow me to then stop the server. What would be helpful is a explanation of how tomcat manages it since that is my app server.
Derby is just a Java application. Any technique you wish to use to run Java applications in the background (/etc/init.d, job control in your shell, etc.) will work fine for Derby.
You can use commands like "kill" or "killall" to kill your background process. Use "jobs" command to see list of running process you've sent to background. Also you can put them back in foreground by doing - "fg %n" (where n is the job number) and kill it using CTRL-C.
I have a need to restart a CentOS service remotely via ssh during an automated, unattended process (executing a build on some software from a build server), but am unsure how to best implement security. Help is needed! ;-)
Environment:
Running an ssh login on a remote box, I want to execute on my server something like:
/sbin/service jetty restart.
The ssh call is being made during a maven build process (probably doesn't affect anything, really).
I want the ssh session to login with a user that has practically zero permissions on the server except to execute the above.
I can set up shared key access for the ssh session.
Thanks!
Good idea to use an ssh key. You can then use a 'forced command' for that particular key, so it won't be able to run any other commands. See http://www.eng.cam.ac.uk/help/jpmg/ssh/authorized_keys_howto.html
I have a site that uses a solr search engine, but I've only been able to use it while I'm ssh'ed into the server (Amazon EC2) and run the java -jar start.jar. As soon as I log out of the ssh session, it stops running and nothing is searchable anymore. How can I keep this running even when I'm not accessing the server?
If this needs any more clarification, just comment.
I use
nohup java -jar start.jar &
to achieve what you want.
Either convince it to run in daemon mode, or start it with something like setsid to disassociate it from your login session ID, so that it won't be terminated when your login session is.