java -jar可以正常启动
/usr/bin/java -server -Xms256m -Xmx256m -jar /halo-latest.jar
可以正常启动 而且没有错误
但是添加服务后 用服务启动 起不起来
Redirecting to /bin/systemctl status -l halo.service
● halo.service
Loaded: loaded (/etc/systemd/system/halo.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2020-01-24 14:58:50 CST; 2s ago
Process: 5390 ExecStop=/bin/kill -s QUIT $MAINPID (code=exited, status=1/FAILURE)
Main PID: 5392 (java)
CGroup: /system.slice/halo.service
‣ 5392 [java]
Jan 24 14:58:52 ecs-sn3-medium-2-linux-20200122010104 java[5392]: at org.yaml.snakeyaml.composer.Composer.getNode(Composer.java:85)
Jan 24 14:58:52 ecs-sn3-medium-2-linux-20200122010104 java[5392]: at org.yaml.snakeyaml.constructor.BaseConstructor.getData(BaseConstructor.java:125)
Jan 24 14:58:52 ecs-sn3-medium-2-linux-20200122010104 java[5392]: at org.yaml.snakeyaml.Yaml$1.next(Yaml.java:548)
Jan 24 14:58:52 ecs-sn3-medium-2-linux-20200122010104 java[5392]: at org.springframework.beans.factory.config.YamlProcessor.process(YamlProcessor.java:160)
Jan 24 14:58:52 ecs-sn3-medium-2-linux-20200122010104 java[5392]: at org.springframework.beans.factory.config.YamlProcessor.process(YamlProcessor.java:134)
Jan 24 14:58:52 ecs-sn3-medium-2-linux-20200122010104 java[5392]: at org.springframework.boot.env.OriginTrackedYamlLoader.load(OriginTrackedYamlLoader.java:75)
Jan 24 14:58:52 ecs-sn3-medium-2-linux-20200122010104 java[5392]: at org.springframework.boot.env.YamlPropertySourceLoader.load(YamlPropertySourceLoader.java:50)
Jan 24 14:58:52 ecs-sn3-medium-2-linux-20200122010104 java[5392]: at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.loadDocuments(ConfigFileApplicationListener.java:562)
Jan 24 14:58:52 ecs-sn3-medium-2-linux-20200122010104 java[5392]: at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:518)
Jan 24 14:58:52 ecs-sn3-medium-2-linux-20200122010104 java[5392]: ... 33 common frames omitted
[root@ecs-sn3-medium-2-linux-20200122010104 ~]# sudo service halo status -l
Redirecting to /bin/systemctl status -l halo.service
● halo.service
Loaded: loaded (/etc/systemd/system/halo.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2020-01-24 15:07:29 CST; 2s ago
Process: 8201 ExecStop=/bin/kill -s QUIT $MAINPID (code=exited, status=1/FAILURE)
Main PID: 8203 (java)
CGroup: /system.slice/halo.service
└─8203 /usr/bin/java -server -Xms256m -Xmx256m -jar /halo-latest.jar
Jan 24 15:07:29 ecs-sn3-medium-2-linux-20200122010104 systemd[1]: halo.service holdoff time over, scheduling restart.
Jan 24 15:07:29 ecs-sn3-medium-2-linux-20200122010104 systemd[1]: Stopped halo.service.
Jan 24 15:07:29 ecs-sn3-medium-2-linux-20200122010104 systemd[1]: Started halo.service.
这是配置
Description=Halo Service
Documentation=https://halo.run
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
ExecStart=/usr/bin/java -server -Xms256m -Xmx256m -jar /halo-latest.jar
ExecStop=/bin/kill -s QUIT $MAINPID
Restart=always
StandOutput=syslog
StandError=inherit
[Install]
WantedBy=multi-user.target