I have an older jetty server I want to turn into as a service on a Debian OS. It should start automatic each time I restart the computer.
Manually I start the server with the two following commands:
root#myserver:/# cd /opt/jdk/jetty
root#myserver:/opt/jdk/jetty# java jetty
Anyone know how to do this ?
If you want to start any program on booting you can add that entry in rc.local.
java /opt/jdk/jetty/jetty
It will start on reboot
Related
I am running Spring Boot application in embedded Tomcat server. I am placing the executable jar file with Tomcat server embedded in it in a path in Linux server, logging in to Linux environment using putty, navigating to the path where I have kept my jar file and running as
java -jar my-jar.jar
The problem is using this way the embedded tomcat server will stop and the jar file will stop running when putty is exited. Can you suggest a way how to execute the executable jar file so that it keeps running in the Linux environment without stopping.
One solution I found is to run the jar as a service of Linux. Is there any other way of doing this?
You can start it as background process:
java -jar my-jar.jar &
But the Linux service is the better way.
I have Raspbian Jessie 8 running in a Raspberry Pi 3. There are 3 JavaScript services that are automatically started by PM2.
However, if the Raspberry is shutdown incorrectly, e.g., if the energy cable is removed, the services don't start.
They only start automatically if the Raspberry is shutdown properly, e.g., using sudo reboot.
I need a shell script that checks if the Raspberry was incorrectly shutdown and, if it was, to be rebooted using sudo reboot.
I saw here and here how to create a simple reboot script and here how to check if a service is running, but found nothing on how to check for an improper shutdown. Can anyone tell me how?
You can always put your services start in the legacy startup-file /etc/rc.local that is a shell script called as the very last thing in the startup. Make sure its executable.
Thanks for looking into my question.
I am running tomcat as windows service in windows machine. how can I achieve the same on linux machines.
it should start automatically after reboot.
Thanks,
R Dama.
If you install Tomcat from a Linux distribution package, it will usually include an init script which will start it as a daemon via a start stop script. You can create a script for it manually otherwise. See https://www.linux.com/learn/managing-linux-daemons-init-scripts
I installed mongodb by Ubuntu Software Center in ubuntu 15.10 desktop. Service Mongodb starts automatically every time when I boot my laptop. Because it is not in the server edition os, so I want to start or stop the service manually, like sudo sevice mongodb start/stop.
I've tied to comment # start on runlevel [2345] in /etc/init/mongodb.conf, and remove all *mongo* from all /etc/rc*.d/.
The service still starts automatically.
So, please help me.
This should do it:
sudo update-rc.d mongodb disable
This should work for Ubuntu 16.04. Not sure if 15.10 was still using upstart or not.
For more information, the same question has been asked over AskUbuntu, check the other answers there for more information.
few months ago I got access to a VPS with installed Debian 8 Jessie.
The strange thing for me was that after perform some action (like service [stop|start|restart], debian not notify me (ex: Restarting nginx: nginx, like old debian 7 wheezy).
Yesterday, i installed on my virtual machine Debian 8 Jessie, but the "bug" persists.
Should I install something extra library, or to set up them?
Thanks in advance.
Debian uses systemd now.
systemctl start example1
Investigate why systemd hangs on startup or on reboot/shutdown.
Increase verbosity via cmdline: Add "systemd.log_target=kmsg systemd.log_level=debug"
[ /etc/default/grub ]
GRUB_CMDLINE_LINUX="systemd.log_target=kmsg systemd.log_level=debug" <--- Add here (by uncommenting you can easily switch to debug)
# update-grub
Systemd is not as verbose as the old SysV scripts, so your described "bug" is intended behaviour.
The old commands, like "service" are just simple symlinks / script which delegate the work to systemd.
As far as I know this is the same for the /etc/init.d scripts.