How can I make a program to run as service in Linux - linux

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

Related

Create shell script to reboot linux in case of incorrect shutdown

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.

debian8 not response after restart/stop/start

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.

Run a program as a service on Debian/Linux

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

How to run Shiny Server on linux using remote acces?

I'm trying to put in production my shiny app. I can run my shiny app locally on my Windows machine, from R. However, since we need to use Linux to deploy the app over the web, we decided to use a Linux server for that. We access this Linux server remotely, from our local machines (running Windows).
I followed the instruction at the RStudio website, and successful installed Shine Server on the Linux server. Its's running on it. I don't know what to do next. So, my question is: what should I do next? Please, remember that I access the Linux server remotely (using puty). Also, I have almost no knowledge of Linux.
Any guidance on what to do next is very welcome.
Some info that may be useful:
I use a Ubuntu 12.04.3
I ran as root (I think, but I can use sudo, for sure).
Another person has access to this server besides me.
We use R 3.0.2
you can follow the instructions here:
https://groups.google.com/forum/#!msg/shiny-discuss/NuZp0ziVXvw/BXHcIoXThnoJ
Short answer:
# this is all one line
sudo wget\
https://raw.github.com/rstudio/shiny-server/master/config/upstart/shiny-server.conf\
-O /etc/init/shiny-server.conf
# Start the server
sudo start shiny-server
Then just open a browser and point to it

Simple protocol for remote process startup/shutdown

I'm looking for a simple protocol to control remote processes from one managing application. The remote processes will run on Windows and Linux (x86).
Is there a simple protocol for managing remote processes, for which I could find daemons that run on both Windows and Linux?
I consider ssh to be the "Swiss-army knife" of remote administration. A custom script communicating over ssh can then do the process management. On Windows, I install ssh as part of Cygwin.
On windows you can use shutdown.exe \\remote_name [/y] [/c]
http://support.microsoft.com/kb/317371
Thanks Nathan.
Windows users can also use the following package instead of Cygwin: http://sshwindows.sourceforge.net/

Resources