@Ryan Wang 👍
操作系统 Ubuntu Server 22.04 LTS 64bit
因为刚接触,对shell脚本并不了解,修改了文件访问权限。
使用新建用户方法
#文件配置:
[Unit]
Description=Halo Service
Documentation=https://docs.halo.run
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=anonym
ExecStart=/home/anonym/app/halo.jar -server -Xms256m -Xmx256m -jar YOUR_JAR_PATH
ExecStop=/bin/kill -s QUIT $MAINPID
Restart=always
StandOutput=syslog
StandError=inherit
[Install]
WantedBy=multi-user.target
#报错代码如下:
service: Failed to execute /home/anonym/app/halo.jar: Exec format error
service: Failed at step EXEC spawning /home/anonym/app/halo.jar: Exec format error
vice: Main process exited, code=exited, status=203/EXEC
vice: Failed with result 'exit-code'.
vice: Scheduled restart job, restart counter is at 4.
Halo Service.
Halo Service.
service: Failed to execute /home/anonym/app/halo.jar: Exec format error
service: Failed at step EXEC spawning /home/anonym/app/halo.jar: Exec format error
vice: Main process exited, code=exited, status=203/EXEC
vice: Failed with result 'exit-code'.
vice: Scheduled restart job, restart counter is at 5.
Halo Service.
vice: Start request repeated too quickly.
vice: Failed with result 'exit-code'.
o start Halo Service.
temd/system/halo.service:13: Unknown key name 'StandOutput' in section 'Service', ignoring.
temd/system/halo.service:15: Unknown key name 'StandError' in section 'Service', ignoring.