Stop services gracefully on shutdown (increase timer)

I have a service with a long stop procedure (up to 3-5 Minutes sometimes)

The service is handling a database and harddrives. Upon shutdown, ubuntu gives the service a few seconds (i think 90) before killing it. This poses risk of corrupted files. Is there a way to increase that shutdown timer?


Solution 1:

This is controlled in /etc/systemd/system.conf. #DefaultTimeoutStopSec=90s is commented out: remove the comment sign and add your custom value.