ExecStart bash 脚本不支持包含 * 的文件名

问题描述 投票:0回答:1

sage-server.service

[Service]

ExecStart=/usr/local/jdk-21.0.2+13/bin/java -jar /home/freedom/local/sage-app*.jar

当我运行

systemctl status sage-server
时,失败了。

错误:无法访问 jarfile /home/freedom/local/sage-app*.jar

但是我直接运行

/usr/local/jdk-21.0.2+13/bin/java -jar /home/freedom/local/sage-app*.jar
就成功了。

Linux版本:Debian 12

PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
linux shell debian
1个回答
0
投票

ExecStart 不允许您使用 shell 功能...除非您 ExecStart 一个 shell。

ExecStart=/bin/sh -c '/usr/local/jdk-21.0.2+13/bin/java -jar /home/freedom/local/sage-app*.jar'
© www.soinside.com 2019 - 2024. All rights reserved.