查看一下rc-local.service文件是不是存在
路径:/lib/systemd/system/rc-local.service
内容:
# SPDX-License-Identifier: LGPL-2.1+
#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# This unit gets pulled automatically into multi-user.target by
# systemd-rc-local-generator if /etc/rc.local is executable.
[Unit]
Description=/etc/rc.local Compatibility
Documentation=man:systemd-rc-local-generator(8)
ConditionFileIsExecutable=/etc/rc.local
After=network.target
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
RemainAfterExit=yes
GuessMainPID=no
注:这里面就指出了可执行文件是 /etc/rc.local 。
编辑 /etc/rc.local,如下:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# 单独开机运行stable diffusion时
source ~/anaconda3/etc/profile.d/conda.sh
conda activate sd
cd /www/wwwroot/sd
python launch.py --xformers --listen --enable-insecure-extension-access --no-half-vae --disable-nan-check
# 开机同时自动运行 stable diffusion、kohya、jupter时
/root/stable_diffusion/launch.sh
/root/kohya_ss/launch.sh
/root/.jupyter/launch.sh
exit 0
给 /etc/rc.local
文件添加执行权限:
chmod +x /etc/rc.local