Closed primovist closed 7 years ago
首先要有一个服务,可以起名ddns.service,内容如下: [Unit] Description=Aliyun DDNS Client. Wants=network-online.target After=network.target network-online.target
[Service] Type=simple WorkingDirectory=/root/tools/aliyun-ddns-client
ExecStart=/usr/bin/python ddns.py
然后有个同名的Timer文件,ddns.timer,内容如下: [Unit] Description=Run Aliyun DDNS Client every 10 minutes.
[Timer] OnBootSec=0s OnUnitActiveSec=10min
Unit=ddns.service
[Install] WantedBy=multi-user.target
两个文件同时放入/usr/lib/systemd/system文件夹中,然后运行命令
可以查看状态:
Thanks, merged to the master branch.
首先要有一个服务,可以起名ddns.service,内容如下: [Unit] Description=Aliyun DDNS Client. Wants=network-online.target After=network.target network-online.target
[Service] Type=simple WorkingDirectory=/root/tools/aliyun-ddns-client
这里写上你的aliyun-ddns-client文件夹地址,如果用我的范例请放入/root文件夹下
ExecStart=/usr/bin/python ddns.py
然后有个同名的Timer文件,ddns.timer,内容如下: [Unit] Description=Run Aliyun DDNS Client every 10 minutes.
[Timer] OnBootSec=0s OnUnitActiveSec=10min
这里可以改成你喜欢的时间
Unit=ddns.service
默认不写Unit时Timer文件运行同名Service,可以省略
[Install] WantedBy=multi-user.target
两个文件同时放入/usr/lib/systemd/system文件夹中,然后运行命令
systemctl daemon-reload
systemctl enable ddns.timer
可以查看状态:
systemctl status ddns.timer