180 条记录
15 私有链接
15 私有链接
#!/sbin/openrc-run
command="/service/alist/alist"
command_args="server"
name="alist"
description="AList file server"
directory="/service/alist"
depend() {
need net
}
start() {
ebegin "Starting AList"
# 检查 AList 是否已经在运行,如果运行则不启动
if pgrep -f "$command $command_args" > /dev/null; then
ebegin "AList is already running"
eend 0
else
# 确保在正确的目录下启动 AList
cd "$directory" && $command $command_args &
# 等待进程启动并确认是否启动成功
sleep 2
if pgrep -f "$command $command_args" > /dev/null; then
ebegin "AList is running"
eend 0
else
ebegin "AList failed to start"
tail -n 10 /var/log/messages
eend 1
fi
fi
}
stop() {
ebegin "Stopping AList"
# 使用 pkill 来终止 AList 进程
pkill -f "$command $command_args"
eend $?
}
restart() {
stop
start
}