1

これは私のスクリプトです:

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
bin=${DIR}/../
lib=${DIR}/../../lib

echo '
{
    "type" : "jdbc",
    "jdbc" : {
        "schedule" : "0 0/1 * 1/1 * ? *",
        "url" : "jdbc:mysql://localhost:3306/mydb",
        "user" : "",
        "password" : "",
        "elasticsearch" : {
            "cluster" : "elasticsearch",
            "host" : "localhost",
            "port" : 9300
        },
        "sql" : [
            {
                "statement" : "/var/test.sql"
            }
        ],
        "index" : "myindex",
        "type" : "mytype"
    }
} ' | java \
    -cp "${lib}/*" \
    -Dlog4j.configurationFile=${bin}/log4j2.xml \
    org.xbib.tools.Runner \
    org.xbib.tools.JDBCImporter

最後に & を付けてスクリプトを実行すると、正常に動作しますが、このスクリプトを実行するより良い方法はありますか? 多分サービスとして?

4

0 に答える 0