sakuravps側でのcrontab設定
passそのままなのでwarning出るので。。早めに直そ。
***************************
■crontabの設定
***************************
10 * * * * mysql -u ra******ai -pAa******56 20****301_m*****ure_se***or < 20170303_sql_ms_upd1
■crontabの設定
***************************
10 * * * * mysql -u ra******ai -pAa******56 20****301_m*****ure_se***or < 20170303_sql_ms_upd1
***************************
■crontabでSQL実行させるファイル”20170303_sql_ms_upd1″
試しSQL(OKになったもの)
試しSQL(OKになったもの)
***************************
UPDATE `ms_tbl` SET `adc`=100,`read_adc`=100,`volts`=100,`comment`=100 WHERE Num = 33;
***************************
UPDATE `ms_tbl` SET
`time_stamp` = CURRENT_TIMESTAMP,
`adc`=@adc_d,
`read_adc`=@read_adc_d
WHERE Num = @num_d;
***************************
UPDATE `ms_tbl` SET `adc`=100,`read_adc`=100,`volts`=100,`comment`=100 WHERE Num = 33;
***************************
UPDATE `ms_tbl` SET
`time_stamp` = CURRENT_TIMESTAMP,
`adc`=@adc_d,
`read_adc`=@read_adc_d
WHERE Num = @num_d;
***************************
SELECT Num, adc, read_adc into @num_d, @adc_d, @read_adc_d
from ms_tbl WHERE Num IN (SELECT max(Num) FROM ms_tbl);
from ms_tbl WHERE Num IN (SELECT max(Num) FROM ms_tbl);
UPDATE `ms_tbl` SET
`time_stamp` = CURRENT_TIMESTAMP,
`adc`=@adc_d,
`read_adc`=@read_adc_d,
`volts` = (
case when @read_adc_d > 50
then ‘read_adc>50’
when @read_adc_d < 20
then ‘read_adc<20’
else
‘read_adc=20-50’
end),
`comment` = ‘2017/03/04_chg_comment’
WHERE Num = @num_d;
`time_stamp` = CURRENT_TIMESTAMP,
`adc`=@adc_d,
`read_adc`=@read_adc_d,
`volts` = (
case when @read_adc_d > 50
then ‘read_adc>50’
when @read_adc_d < 20
then ‘read_adc<20’
else
‘read_adc=20-50’
end),
`comment` = ‘2017/03/04_chg_comment’
WHERE Num = @num_d;
***************************