April 29th, 2012
In Technology
No Comments
If you enjoy this article, see the other most popular articles
If you enjoy this article, see the other most popular articles
If you enjoy this article, see the other most popular articles
Run Java as a daemon
(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at: lawrence@krubner.com, or follow me on Twitter.
How to run a Java Program as a daemon (service) on Linux (openSUSE) using a shell script
The following alternatives may be used to run a Java program as a daemon on Linux:
Use the Java Service Wrapper.
Use the Apache Jakarta Commons Daemon package (Jsvc).
Use a shell script.
This article describes how to use a shell script. The disadvantage of the Java Wrapper and the Commons Daemon package is that they both make use of C programs. These C programs have to be compiled (or a matching binary distribution has to be found) and have to be compatible with the operating system and the installed Java runtime environment. A shell script, on the other hand, is easier to adapt to changing OS and Java environments.Features
The shell script (javaDaemonTest.sh) provides the following functionality:Start/stop the Java daemon process, according to the Linux system init script convention.
Run the Java daemon as a different (non-root) Linux user.
Log error messages and redirect StdOut/StdErr output into a log file.
Install/uninstall the daemon as a Linux service.
(The “install” procedure installs the script in /etc/init.d, enables the service in the configured default runlevels, creates the “rc” command (symlink) and creates the Linux user (as a system account) and group if necessary).
Post external references
- 1
http://www.source-code.biz/snippets/java/7.htm
February 8, 2022 9:33 am
From Michael S on How I recovered from Lyme Disease: I fasted for two weeks, no food, just water
"Did you have Bartonella, too? Seems it uses autogenesis..."