|
|
|
@ -82,11 +82,30 @@ fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 进入仓库目录
|
|
|
|
|
cd $local_dir || { echo "无法进入目录 $local_dir"; exit 1; }
|
|
|
|
|
|
|
|
|
|
if [ -f "download_and_execute.sh" ]; then
|
|
|
|
|
# 如果没有执行权限,尝试添加执行权限
|
|
|
|
|
if [ ! -x "download_and_execute.sh" ]; then
|
|
|
|
|
echo "download_and_execute.sh 没有执行权限,尝试添加执行权限..."
|
|
|
|
|
chmod +x "download_and_execute.sh" || { echo "无法添加执行权限"; exit 1; }
|
|
|
|
|
mv download_and_execute.sh ../ || { echo "无法移动文件"; exit 1; }
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
echo "download_and_execute.sh 不存在"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
cp download_and_execute.service /etc/systemd/system || { echo "无法复制文件"; exit 1; }
|
|
|
|
|
|
|
|
|
|
sudo systemctl enable download_and_execute.service || { echo "无法启用服务"; exit 1; }
|
|
|
|
|
sudo systemctl start download_and_execute.service || { echo "无法启动服务"; exit 1; }
|
|
|
|
|
|
|
|
|
|
# 检查服务是否已启用
|
|
|
|
|
if sudo systemctl is-enabled download_and_execute.service; then
|
|
|
|
|
echo "开机重载服务已启动"
|
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
# 进入仓库目录
|
|
|
|
|
cd $local_dir || { echo "无法进入目录 $local_dir"; exit 1; }
|
|
|
|
|
|
|
|
|
|
# 检查smp_init.sh是否存在
|
|
|
|
|
if [ -f "smp_init.sh" ]; then
|
|
|
|
|