每天在MYSQL数据库上运行sql脚本

时间:2017-10-10 15:54:20

标签: mysql webserver

我有两个脚本,worker.sql和updater.sql我需要每天在我的网站上运行。我不是必须登录控制台等,而是希望能够每天运行脚本,分别在00:05和00:10自动运行。

我还希望能够从我的网站的管理控制台调用这些脚本,但这可以在以后发生。

我有一个完整的网站托管包,并且有cron作业可用性,但我不知道如何去做,我的问题是这些sql文件将定期更新并且会非常大。

这是两个文件之一的示例:

/* Title        : Database ORGANIZATION Script
/* Author       : David Cummings
/* Date         : 10th October 2017
/* Description  : This script runs through the database and adjusts
/*              : input to the correct formats. This will make the 
/*              : data all uniform in apparence.
/*              : V1.2

/* Remove Rogue spots
DELETE FROM spotting WHERE location IS NULL;
DELETE FROM spotting WHERE uname IS NULL;
DELETE FROM spotting WHERE type IS NULL;

/* Edit Operaters
SET operater = replace(operater, 'SAS', 'Scandinavian Airlines System');
SET operater = replace(operater, 'Easyjet', 'easyJet');

/* Update the Make
UPDATE spotting 
SET make = replace(make, 'airbus', 'Airbus');
SET make = replace(make, 'beoing', 'Boeing');
SET make = replace(make, 'boeing', 'Boeing');
SET make = replace(make, 'ATR', 'Aerospatiale');
SET make = replace(make, 'de', 'Bombardier');

/* Update the Model
UPDATE spotting
SET model = replace(model, 'ERJ170-200STD', 'ERJ-175STD (170-200)');
SET model = replace(model, '737-%', 'B737-%');

/* Misc Types
SET model = replace(model, '%/F', 'F');

/* Boeing Range types
SET model = replace(model, '%(ER)', '%ER');
SET model = replace(model, '%(LR)', '%LR');
SET model = replace(model, '%(QC)', '%QC');
SET model = replace(model, '%(BCF)', '%BCF');
SET model = replace(model, '%/W/W', '%/W');

/* Airbus Winglet Types
SET model = replace(model, '%/SL' '%/W');
SET model = replace(model, '%/S' '%/W');

/* Aerospatiale Types

0 个答案:

没有答案