{"id":16045,"date":"2023-07-29T05:55:12","date_gmt":"2023-07-28T21:55:12","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=16045"},"modified":"2023-07-29T05:55:12","modified_gmt":"2023-07-28T21:55:12","slug":"systemd-timer-mysql","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/systemd-timer-mysql.html","title":{"rendered":"\u4f7f\u7528 systemd timer \u5907\u4efd\u6570\u636e\u5e93"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | \u4e3b\u8981\u7684Linux\u53d1\u884c\u7248\u90fd\u6539\u7528systemd \u6765\u66ff\u4ee3 System V\u542f\u52a8\u65b9\u5f0f\uff0c\u5176\u4e2d systemd timer \u80fd\u66ff\u4ee3 crontab \u8ba1\u5212\u4efb\u52a1\u7684\u5927\u90e8\u5206\u529f\u80fd\u3002\u672c\u6587\u4ecb\u7ecd\u4e86\u7528systemd timer\u5982\u4f55\u5b9e\u73b0\u6570\u636e\u5e93\u5907\u4efd\uff0c\u5176\u4ed6\u7c7b\u578b\u7684\u8ba1\u5212\u4efb\u52a1\u53ef\u4ee5\u540c\u7406\u5b9e\u73b0\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n <\/p>\n \u5b9a\u4e49timer\u6587\u4ef6<\/strong><\/div>\n \u8fdb\u5165\u76ee\u5f55\/usr\/lib\/systemd\/system\uff0c\u6309\u5982\u4e0b\u6587\u4ef6\u5efa\u7acbtimer\uff1a<\/p>\n [Unit]\r\nDescription=Runs db backup every hour\r\n\r\n[Timer]\r\n# Time to wait after booting before we run first time\r\nOnBootSec=10min\r\n# Time between running each consecutive time\r\nOnUnitActiveSec=1h\r\nUnit=db_backup.service\r\n\r\n[Install]\r\nWantedBy=multi-user.target\r\n<\/pre>\n |