You are not logged in.
I'm really new to systemd and I'm trying to make my first service, it works for the most part, but I can't seem to get it to load on boot.
[Unit]
Description=Teamspeak Service
Wants=network-online.target
[Service]
WorkingDirectory=/srv/ts3
User=admin
ExecStart=/srv/ts3/ts3server_minimal_runscript.sh
ExecStop=/srv/ts3/ts3server_startscript.sh stop
ExecReload=/srv/ts3/ts3server_startscript.sh restart
Restart=always
RestartSec=15
[Install]
WantedBy=multi-user.target
When I start it manually using "systemctl start teamspeak" or "systemctl restart teamspeak" it works fine, producing this output:
[root@firefly ~]# systemctl start teamspeak
[root@firefly ~]# systemctl -l status teamspeak
teamspeak.service - Teamspeak Service
Loaded: loaded (/etc/systemd/system/teamspeak.service; enabled)
Active: active (running) since Tue 2013-12-17 12:15:01 EST; 24s ago
Process: 309 ExecStop=/srv/ts3/ts3server_startscript.sh stop (code=exited, status=7)
Main PID: 324 (ts3server_minim)
CGroup: /system.slice/teamspeak.service
|-324 /bin/sh /srv/ts3/ts3server_minimal_runscript.sh
`-333 ./ts3server_linux_amd64
Dec 17 12:15:03 firefly ts3server_minimal_runscript.sh[324]: 2013-12-17 17:15:03.414959|INFO |CIDRManager | | updated query_ip_whitelist ips: 127.0.0.1,
Dec 17 12:15:03 firefly ts3server_minimal_runscript.sh[324]: 2013-12-17 17:15:03.416158|INFO |Query | | listening on 0.0.0.0:10011
Dec 17 12:15:04 firefly ts3server_minimal_runscript.sh[324]: 2013-12-17 17:15:04.028519|INFO | | | License expired, but there is a new one available.. retrieving
Dec 17 12:15:04 firefly ts3server_minimal_runscript.sh[324]: 2013-12-17 17:15:04.246774|INFO |Accounting | | Your license was updated by the licensing server
Dec 17 12:15:04 firefly ts3server_minimal_runscript.sh[324]: 2013-12-17 17:15:04.798725|INFO |Accounting | | Licensing Information
Dec 17 12:15:04 firefly ts3server_minimal_runscript.sh[324]: 2013-12-17 17:15:04.799402|INFO |Accounting | | type : Non-profit
Dec 17 12:15:04 firefly ts3server_minimal_runscript.sh[324]: 2013-12-17 17:15:04.799796|INFO |Accounting | | starting date : Mon Jul 1 00:00:00 2013
Dec 17 12:15:04 firefly ts3server_minimal_runscript.sh[324]: 2013-12-17 17:15:04.800142|INFO |Accounting | | ending date : Wed Jan 8 00:00:00 2014
Dec 17 12:15:04 firefly ts3server_minimal_runscript.sh[324]: 2013-12-17 17:15:04.800458|INFO |Accounting | | max virtualservers: 10
Dec 17 12:15:04 firefly ts3server_minimal_runscript.sh[324]: 2013-12-17 17:15:04.800772|INFO |Accounting | | max slots : 512
[root@firefly ~]#
However, immediately after boot, this is what I see:
[root@firefly ~]# systemctl -l status teamspeak
teamspeak.service - Teamspeak Service
Loaded: loaded (/etc/systemd/system/teamspeak.service; enabled)
Active: active (running) since Tue 2013-12-17 12:19:52 EST; 1min 22s ago
Main PID: 174 (ts3server_minim)
CGroup: /system.slice/teamspeak.service
|-174 /bin/sh /srv/ts3/ts3server_minimal_runscript.sh
`-197 ./ts3server_linux_amd64
Dec 17 12:19:53 firefly ts3server_minimal_runscript.sh[174]: 2013-12-17 17:19:53 .639611|ERROR | | | Could not open default UDP connection for w eblist
Dec 17 12:19:53 firefly ts3server_minimal_runscript.sh[174]: 2013-12-17 17:19:53 .691066|INFO |VirtualServer | 1| listening on 0.0.0.0:9987
Dec 17 12:19:53 firefly ts3server_minimal_runscript.sh[174]: 2013-12-17 17:19:53 .692413|INFO |CIDRManager | | updated query_ip_whitelist ips: 127.0.0.1,
Dec 17 12:19:53 firefly ts3server_minimal_runscript.sh[174]: 2013-12-17 17:19:53 .693754|INFO |Query | | listening on 0.0.0.0:10011
Dec 17 12:19:53 firefly ts3server_minimal_runscript.sh[174]: 2013-12-17 17:19:53 .713940|ERROR | | | TS3ANetwork::ResolveHostName failed error: -2 (Name or service not known) 0
Dec 17 12:19:53 firefly ts3server_minimal_runscript.sh[174]: 2013-12-17 17:19:53 .714020|ERROR | | | TS3ANetwork::ResolveHostName failed error: -2 (Name or service not known) 0
Dec 17 12:19:53 firefly ts3server_minimal_runscript.sh[174]: 2013-12-17 17:19:53 .714044|ERROR | | | Unable to connect to primary address, tryin g secondary
Dec 17 12:19:53 firefly ts3server_minimal_runscript.sh[174]: 2013-12-17 17:19:53 .714085|ERROR | | | TS3ANetwork::ResolveHostName failed error: -2 (Name or service not known) 0
Dec 17 12:19:53 firefly ts3server_minimal_runscript.sh[174]: 2013-12-17 17:19:53 .714111|ERROR |Accounting | | license expired, shutting down!
Dec 17 12:19:53 firefly ts3server_minimal_runscript.sh[174]: 2013-12-17 17:19:53 .772479|INFO |VirtualServerBase| 1| stopped
[root@firefly ~]# ps aux | grep "ts3"
admin 174 0.0 0.1 13896 1536 ? Ss 12:19 0:00 /bin/sh /srv/ts3/ts3server_minimal_runscript.sh
admin 197 1.7 1.6 1249432 16916 ? Sl 12:19 0:02 ./ts3server_linux_amd64
root 313 0.0 0.0 8956 656 pts/0 S+ 12:22 0:00 grep ts3
[root@firefly ~]#
It's weird because right after boot, the server is running, but I can't connect, there's like no networking? I opened port 2010 (the one it complains about) via iptables, so I know there isn't a problem with that, it doesn't need that anyway. It's like it tries to load before networking starts perhaps? Does anybody know if there's something I can add to my TeamSpeak service that it could check for? Or something I can use to delay initialization? I also use "systemctl daemon-reload" and "systemctl reload teamspeak" when I make edits to the service. I know TeamSpeak doesn't like to run as root user, but I told it to run as a user "admin".
Thanks
Last edited by PolishHurricane (2013-12-19 23:01:25)
Offline
You use 'wants=network-online.target' but I doubt that exists. Have a look at https://wiki.archlinux.org/index.php/systemd#Targets for some useful pointers
Offline
So would I do something like: Wants=runlevel3.target ?
I tried it, didn't work, sorry I'm kind of retarded.
Offline
Does runlevel3 exists in the output of `systemctl list-units --type=target`?
Offline
Aha! Okay, it listed "network.target", I had "network-online.target", I just needed to change it to "network.target".
Thanks a bunch Spider.
Offline