mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 14:54:29 +01:00
mysql55: Port to systemd
Not tested. Seriously tempted to delete mysql55. See issue #47.
This commit is contained in:
parent
75c67b0194
commit
ab18c03685
1 changed files with 16 additions and 14 deletions
|
@ -84,6 +84,7 @@ in
|
|||
description = "A file containing SQL statements to be executed on the first startup. Can be used for granting certain permissions on the database";
|
||||
};
|
||||
|
||||
# FIXME: remove this option; it's a really bad idea.
|
||||
rootPassword = mkOption {
|
||||
default = null;
|
||||
description = "Path to a file containing the root password, modified on the first startup. Not specifying a root password will leave the root password empty.";
|
||||
|
@ -133,10 +134,12 @@ in
|
|||
|
||||
environment.systemPackages = [mysql];
|
||||
|
||||
jobs.mysql =
|
||||
{ description = "MySQL server";
|
||||
boot.systemd.services.mysql =
|
||||
{ description = "MySQL Server";
|
||||
|
||||
startOn = "filesystem";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
unitConfig.RequiresMountsFor = "${cfg.dataDir}";
|
||||
|
||||
preStart =
|
||||
''
|
||||
|
@ -149,9 +152,12 @@ in
|
|||
|
||||
mkdir -m 0700 -p ${cfg.pidDir}
|
||||
chown -R ${cfg.user} ${cfg.pidDir}
|
||||
'';
|
||||
|
||||
${mysql}/bin/mysqld --defaults-extra-file=${myCnf} ${mysqldOptions} &
|
||||
serviceConfig.ExecStart = "${mysql}/bin/mysqld --defaults-extra-file=${myCnf} ${mysqldOptions}";
|
||||
|
||||
postStart =
|
||||
''
|
||||
# Wait until the MySQL server is available for use
|
||||
count=0
|
||||
while [ ! -e /tmp/mysql.sock ]
|
||||
|
@ -216,14 +222,10 @@ in
|
|||
|
||||
rm /tmp/mysql_init
|
||||
fi
|
||||
'';
|
||||
''; # */
|
||||
|
||||
postStop = "${mysql}/bin/mysqladmin ${optionalString (cfg.rootPassword != null) "--user=root --password=\"$(cat ${cfg.rootPassword})\""} shutdown";
|
||||
|
||||
# !!! Need a postStart script to wait until mysqld is ready to
|
||||
# accept connections.
|
||||
|
||||
extraConfig = "kill timeout 60";
|
||||
serviceConfig.ExecStop =
|
||||
"${mysql}/bin/mysqladmin ${optionalString (cfg.rootPassword != null) "--user=root --password=\"$(cat ${cfg.rootPassword})\""} shutdown";
|
||||
};
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue