I have a server on which I am running a daemon as a normal user. I intend to give access to this user in the future to people I trust... but, as a precaution, I would like any configuration and management to be done without su or sudo access. For this reason I've written a simple systemd user unit and tested that it works. It does.
The problem is when restarting the server. The systemd attempts to start the daemon before mariadb (which this daemon needs) is ready. This causes the daemon to fail repeatedly until it exceeds systemd's StartLimit and systemd stops attempting to start the daemon all together.
There are a number of approaches I could take with this. I could re-write the systemd unit to run a script that queries the sql server over and over till it gets a connection and only then attempts to launch the daemon. Or I could add to the systemd unit a timeout between restarts of say... 30 seconds? But both feel... messy... pedestrian. I'd rather a more elegant solution.
I've been looking over the manpages of systemd but... there's a lot there. Any thoughts?
The unit file in question:
[Unit] Description=Teamspeak 3 [Service] Type=forking #User=teamspeak #Group=teamspeak UMask=0027 Restart=always WorkingDirectory=/home/teamspeak/ts PIDFile=/home/teamspeak/ts/ts3server.pid ExecStart=/home/teamspeak/ts/ts3server_startscript.sh start inifile=/home/teamspeak/ts/ts3server.ini ExecStop=/home/teamspeak/ts/ts3server_startscript.sh stop ExecReload=/home/teamspeak/ts/ts3server_startscript.sh restart [Install] WantedBy=default.target