1 Star 1 Fork 1

axfox/DDNS

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
systemd.sh 1.39 KB
一键复制 编辑 原始数据 按行查看 历史
libshikieiki 提交于 2020-12-17 10:59 . Fix shebang typo (#217)
#!/bin/bash
service='[Unit]
Description=NewFuture ddns
After=network.target
[Service]
Type=simple
WorkingDirectory=/usr/share/DDNS
ExecStart=/usr/bin/env python /usr/share/DDNS/run.py -c /etc/DDNS/config.json
[Install]
WantedBy=multi-user.target'
timer='[Unit]
Description=NewFuture ddns timer
[Timer]
OnUnitActiveSec=5m
Unit=ddns.service
[Install]
WantedBy=multi-user.target'
if [[ "install" == $1 ]]; then
echo "$service" > /usr/lib/systemd/system/ddns.service
echo "$timer" > /usr/lib/systemd/system/ddns.timer
cp -r `pwd` /usr/share/
mkdir -p /etc/DDNS
if [ ! -f "/etc/DDNS/config.json" ];then
if [ -f "config.json" ];then
cp config.json /etc/DDNS/config.json
fi
fi
systemctl enable ddns.timer
systemctl start ddns.timer
echo "installed"
echo "useful commands:"
echo " systemctl status ddns view service status."
echo " journalctl -u ddns.timer view the logs."
echo "config file: /etc/DDNS/config.json"
elif [[ "uninstall" == $1 ]]; then
systemctl disable ddns.timer
rm /usr/lib/systemd/system/ddns.service
rm /usr/lib/systemd/system/ddns.timer
rm -rf /etc/DDNS
rm -rf /usr/share/DDNS
systemctl daemon-reload
echo "uninstalled"
else
echo "Tips:"
echo " $0 install install the ddns systemd service."
echo " $0 uninstall uninstall the ddns service."
fi
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/axfox/DDNS.git
[email protected]:axfox/DDNS.git
axfox
DDNS
DDNS
master

搜索帮助