自启动shell脚本-syncthing-自动同步文件

#!/bin/bash

# 定义syncthing的路径
SYNCTHING_PATH=”/root/syncthing-linux-amd64/syncthing”

# 定义HOME环境变量
export HOME=/root

# 检查syncthing是否已经运行
if pgrep -x “syncthing” > /dev/null; then
echo “syncthing is already running.”
else
echo “syncthing is not running. Starting syncthing…”
nohup $SYNCTHING_PATH -no-browser -logfile /root/syncthing-linux-amd64/syncthing.log > /dev/null 2>&1 &
echo “syncthing started.”
fi