![在 16.04 中将 ddclient 作为服务运行](https://linux22.com/image/1060585/%E5%9C%A8%2016.04%20%E4%B8%AD%E5%B0%86%20ddclient%20%E4%BD%9C%E4%B8%BA%E6%9C%8D%E5%8A%A1%E8%BF%90%E8%A1%8C.png)
没有关于如何做到这一点的描述github 维基或者sourceforge 维基百科只是如何
有一个文件
/etc/default/ddclient
# Configuration for ddclient scripts
# generated from debconf on Thu Jul 27 17:32:33 ACST 2017
#
# /etc/default/ddclient
# Set to "true" if ddclient should be run every time DHCP client ('dhclient'
# from package isc-dhcp-client) updates the systems IP address.
run_dhclient="false"
# Set to "true" if ddclient should be run every time a new ppp connection is
# established. This might be useful, if you are using dial-on-demand.
run_ipup="false"
# Set to "true" if ddclient should run in daemon mode
# If this is changed to true, run_ipup and run_dhclient must be set to false.
run_daemon="true"
# Set the time interval between the updates of the dynamic DNS name in seconds.
# This option only takes effect if the ddclient runs in daemon mode.
daemon_interval="300"
如果我去
sudo systemctl edit --full ddclient.service
使用这些参数创建一个文件
# Automatically generated by systemd-sysv-generator
[Unit]
Documentation=man:systemd-sysv-generator(8)
SourcePath=/etc/init.d/ddclient
Description=LSB: Update dynamic domain name service entries
Before=multi-user.target
Before=multi-user.target
Before=multi-user.target
Before=graphical.target
Before=shutdown.target
After=local-fs.target
After=remote-fs.target
After=network-online.target
After=systemd-journald-dev-log.socket
Wants=network-online.target
Conflicts=shutdown.target
[Service]
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
ExecStart=/etc/init.d/ddclient start
ExecStop=/etc/init.d/ddclient stop
但是它不会在启动时运行..?我只能使用sudo etc/init.d/ddclient start
或手动启动该服务sudo systemctl start ddclient.service
答案1
你要sudo update-rc.d ddclient enable