java使用sh或是jsvc来做daemon应该是主流

jsvc(1): application to launch java daemon - Linux man page

    jsvc(1) - Linux man page
    Name

    jsvc - application to launch java daemon
    Synopsis

    jsvc [-jvm JVM name] [-classpath path] [-cp path] [-home directory] [-version] [-help] [-?] [-nodetach] [-debug] [-check] [-user user] [-wait waittime] [-stop] [-verbose:class|gc|jni] [-outfile /full/path/to/file] [-errfile /full/path/to/file] [-pidfile /full/path/to/file] [-Dproperty=value] [-Xoption]
    Description

    jsvc executes classfile that implements a Daemon interface.
    Options

    -jvm JVM name

        use a specific Java Virtual Machine.
    -cp/ -classpath directory and zip/jar files
        set search path for service classes and resouces
    -home directory
        set the path of your JDK or JRE installation (or set the JAVA_HOME environment variable)
    -version
        show the current Java environment version (to check correctness of -home and -jvm. Implies -nodetach)
    -help
        show this help page (implies -nodetach)
    -nodetach
        don't detach from parent process and become a daemon
    -debug
        verbosely print debugging information
    -check
        only check service (implies -nodetach)
    -stop
        stop the service using the file given in the -pidfile option
    -wait waittime
        wait up to waittime seconds for the service to start waittime should multiple of 10 (min=10)
    -user user
        user used to run the daemon (defaults to current user)
    -verbose[:class|gc|jni]
        enable verbose output
    -outfile /full/path/to/file
        Location for output from stdout (defaults to /dev/null). Use the value '&2' to simulate '1>&2'
    -errfile /full/path/to/file
        Location for output from stderr (defaults to /dev/null). Use the value '&1' to simulate '2>&1'
    -pidfile /full/path/to/file
        Location for output from the file containing the pid of jsvc (defaults to /var/run/jsvc.pid)
    -D<name>=<value>
        set a Java system property
    -X<option>
        set Virtual Machine specific option

    Author

    JSVC is part of the Jakarta Commons Daemon project. Authors are Jean-Frederic Clere, Remy Maucherat, Yoav Shapira, Bill Barker. JSVC is under the Apache License Version 2.0.
原文地址:https://www.cnblogs.com/lexus/p/2364102.html