diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-03-14 08:48:24 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-03-14 08:48:24 +0100 |
commit | 85fe2b41c2ba3a50d94a0d3f5a0910c395fda994 (patch) | |
tree | 5bfcfcc97f7820ad06b8dd03d2957ff30d8e8735 /nixops/modules/databases | |
parent | 4ff905632320a55e0c69500891642d98a00245e2 (diff) | |
download | Nix-85fe2b41c2ba3a50d94a0d3f5a0910c395fda994.tar.gz Nix-85fe2b41c2ba3a50d94a0d3f5a0910c395fda994.tar.zst Nix-85fe2b41c2ba3a50d94a0d3f5a0910c395fda994.zip |
Backup mysql cron
Diffstat (limited to 'nixops/modules/databases')
-rw-r--r-- | nixops/modules/databases/mysql.nix | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/nixops/modules/databases/mysql.nix b/nixops/modules/databases/mysql.nix index acf4750..a625d48 100644 --- a/nixops/modules/databases/mysql.nix +++ b/nixops/modules/databases/mysql.nix | |||
@@ -51,6 +51,21 @@ in { | |||
51 | ''; | 51 | ''; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | services.cron = { | ||
55 | enable = true; | ||
56 | systemCronJobs = let | ||
57 | mycnf = pkgs.writeText "my.cnf" '' | ||
58 | [mysqldump] | ||
59 | user = root | ||
60 | password = ${myconfig.env.databases.mysql.systemUsers.root} | ||
61 | ''; | ||
62 | in [ | ||
63 | '' | ||
64 | 30 1,13 * * * root ${pkgs.mariadb}/bin/mysqldump --defaults-file=${mycnf} --all-databases > /var/lib/mysql/backup.sql | ||
65 | '' | ||
66 | ]; | ||
67 | }; | ||
68 | |||
54 | security.pam.services = let | 69 | security.pam.services = let |
55 | pam_ldap = "${pkgs.pam_ldap}/lib/security/pam_ldap.so"; | 70 | pam_ldap = "${pkgs.pam_ldap}/lib/security/pam_ldap.so"; |
56 | pam_ldap_mysql = with myconfig.env.databases.mysql.pam; | 71 | pam_ldap_mysql = with myconfig.env.databases.mysql.pam; |