Ubuntu systemd 服务带有一些参数

Ubuntu systemd 服务带有一些参数
$ echoip -h
Usage:
  echoip [OPTIONS]

Application Options:
  -f, --country-db=FILE        Path to GeoIP country database
  -c, --city-db=FILE           Path to GeoIP city database
  -a, --asn-db=FILE            Path to GeoIP ASN database
  -l, --listen=ADDR            Listening address (default: :8080)
  -r, --reverse-lookup         Perform reverse hostname lookups
  -p, --port-lookup            Enable port lookup
  -t, --template=FILE          Path to template (default: index.html)
  -H, --trusted-header=NAME    Header to trust for remote IP, if present (e.g. X-Real-IP)

Help Options:
  -h, --help                   Show this help message

当前有效的配置如下,但我需要传递一些参数:

我想要命令:

ExecStart=/root/work/bin/echoip -c=/root/G.mmdb -f=/root/G1.mmdb -a=/root/A.mmdb -t=/root/goweb/bin/index.html

代替

ExecStart=/root/goweb/bin/echoip

[Unit]
Description=goweb

[Service]
User=root
Type=forking
Restart=always
RestartSec=5s
ExecStart=/root/goweb/bin/echoip -c=/root/goweb/bin/data/city.mmdb -f=/root/goweb/bin/data/country.mmdb -a=/root/goweb/bin/data/asn.mmdb -t=/root/goweb/bin/index.html

[Install]
WantedBy=multi-user.target

日志:

journalctl -u goweb.service

Jan 20 13:55:49 ip systemd[1]: Starting goweb...
Jan 20 13:55:49 ip echoip[803]: echoip: Listening on http://0.0.0.0:8080
Jan 20 13:57:19 ip systemd[1]: goweb.service: Start operation timed out. Terminating.
Jan 20 13:57:19 ip systemd[1]: goweb.service: Failed with result 'timeout'.
Jan 20 13:57:19 ip systemd[1]: Failed to start goweb.
Jan 20 13:57:24 ip systemd[1]: goweb.service: Service hold-off time over, scheduling restart.
Jan 20 13:57:24 ip systemd[1]: goweb.service: Scheduled restart job, restart counter is at 1.
Jan 20 13:57:24 ip systemd[1]: Stopped goweb.
Jan 20 13:57:24 ip systemd[1]: Starting goweb...
Jan 20 13:57:24 ip echoip[1188]: echoip: Listening on http://0.0.0.0:8080
Jan 20 13:58:54 ip systemd[1]: goweb.service: Start operation timed out. Terminating.
Jan 20 13:58:54 ip systemd[1]: goweb.service: Failed with result 'timeout'.
Jan 20 13:58:54 ip systemd[1]: Failed to start goweb.

相关内容