a555f2
# It's not recommended to modify this file in-place, because it will be
a555f2
# overwritten during package upgrades.  If you want to customize, the
a555f2
# best way is to create a file "/etc/systemd/system/@DAEMON_NAME@.service",
a555f2
# containing
a555f2
#	.include /usr/lib/systemd/system/@DAEMON_NAME@.service
a555f2
#	...make your changes here...
a555f2
# or create a file "/etc/systemd/system/@DAEMON_NAME@.service.d/foo.conf",
a555f2
# which doesn't need to include ".include" call and which will be parsed
a555f2
# after the file @DAEMON_NAME@.service itself is parsed.
a555f2
#
a555f2
# For more info about custom unit files, see systemd.unit(5) or
a555f2
# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F
a555f2
a555f2
# For example, if you want to increase mysql's open-files-limit to 10000,
a555f2
# you need to increase systemd's LimitNOFILE setting, so create a file named
a555f2
# "/etc/systemd/system/@DAEMON_NAME@.service.d/limits.conf" containing:
a555f2
#	[Service]
a555f2
#	LimitNOFILE=10000
a555f2
a555f2
# Note: /usr/lib/... is recommended in the .include line though /lib/...
a555f2
# still works.
a555f2
# Don't forget to reload systemd daemon after you change unit configuration:
a555f2
# root> systemctl --system daemon-reload
a555f2
a555f2
# Use [mysqld.INSTANCENAME] as sections in my.cnf to configure this instance.
a555f2
a555f2
[Unit]
a555f2
Description=@NICE_PROJECT_NAME@ @MAJOR_VERSION@.@MINOR_VERSION@ database server
a555f2
Documentation=man:mysqld(8)
a555f2
Documentation=https://mariadb.com/kb/en/library/systemd/
a555f2
After=network.target
a555f2
a555f2
[Install]
a555f2
WantedBy=multi-user.target
a555f2
Alias=mysql.service
a555f2
Alias=mysqld.service
a555f2
a555f2
[Service]
a555f2
Type=notify
a555f2
User=mysql
a555f2
Group=mysql
a555f2
a555f2
ExecStartPre=@libexecdir@/mysql-check-socket
a555f2
# '%n' expands to 'Full unit name'; man systemd.unit
a555f2
ExecStartPre=@libexecdir@/mysql-prepare-db-dir %n
a555f2
# MYSQLD_OPTS here is for users to set in /etc/systemd/system/@DAEMON_NAME@@.service.d/MY_SPECIAL.conf
a555f2
# Note: we set --basedir to prevent probes that might trigger SELinux alarms,
a555f2
# per bug #547485
a555f2
ExecStart=@libexecdir@/mysqld --basedir=@prefix@ $MYSQLD_OPTS $_WSREP_NEW_CLUSTER
a555f2
ExecStartPost=@libexecdir@/mysql-check-upgrade
a555f2
a555f2
# Setting this to true can break replication and the Type=notify settings
a555f2
# See also bind-address mysqld option.
a555f2
PrivateNetwork=false
a555f2
a555f2
KillMode=process
a555f2
KillSignal=SIGTERM
a555f2
a555f2
# Don't want to see an automated SIGKILL ever
a555f2
SendSIGKILL=no
a555f2
a555f2
# Restart crashed server only, on-failure would also restart, for example, when
a555f2
# my.cnf contains unknown option
a555f2
Restart=on-abort
a555f2
RestartSec=5s
a555f2
a555f2
UMask=007
a555f2
a555f2
# Give a reasonable amount of time for the server to start up/shut down
a555f2
TimeoutSec=300
a555f2
a555f2
# Place temp files in a secure directory, not /tmp
a555f2
PrivateTmp=true