linux定时跑任务(mysql)

定时跑任务:
 
1. 先把mysql更新命令写成bash script watch_script.sh:
#!/bin/bash
mysql -u root -P 18148 -h 127.0.0.1 -pdeepwise -D deepwise -e "update DW_AI_TASK set task_status=-3 where task_type="CoronaryDiagnose";"
 
(用户 root,端口18148,host 127.0.0.1, 密码deepwise,数据库 deepwise,-e 指令)
 
2. watch -n 300 ./watch_script.sh
每300秒跑一次
 
是否需要在screen中跑?

 

 
原文地址:https://www.cnblogs.com/imoon22/p/14013431.html