linux--crontab 定时任务
来源:互联网 发布:淘宝虚拟宝贝的类目 编辑:程序博客网 时间:2024/06/04 19:03
运行jar 的定时任务:
运行之前要给脚本加权限:
chmod +x ana_dim_union_voice_launcher_sumday.sh
首先写一个sh脚本,脚本中如下:
如下为运行jar 的脚本:
#!/bin/bash#set -e: if the execution result of then instruction is not equle 0 ,then exit automaticallyset -e#set -u: if the variable to be used is not be define,you will get an error message.set -ujava -jar /home/changhong/hanya/tencent_data.jar /home/changhong/hanya/tencent
注意:要写jar 所在位置的绝对路径 后面一个为目录的绝对路径
如下为运行sql的脚本:
#!/bin/bash#set -e: if the execution result of then instruction is not equle 0 ,then exit automaticallyset -e#set -u: if the variable to be used is not be define,you will get an error message.set -usource /etc/profile.d/cust_path.shsource ${SYS_SHELL_PATH}/shell.cfgEXEC_SQL=${COMMON_EXEC_SQL}report_yd=`date -d "-1 day" +%Y%m%d`sql="insert into ana_launcher_video(mac,portal_name,poster_name,sum_count,reportdate,sum_day)select mac,portal_name,poster_name,sum_count,reportdate,1 from tv_launcher_pwhere coalesce(poster_name,'') != '' and reportdate=${report_yd} and (portal_name='点播' or portal_name='UMAX' or portal_name='精选' or portal_name='企鹅精选' );"${EXEC_SQL} -e "$sql"
脚本写完后,输入crontab -e 编辑定时任务:
如下为两个定时任务:为每天执行的任务
00 04 * * * sh /hwdata/sh/hy_work/ana_dim_launcher_video.sh
00 06 * * * sh /hwdata/sh/hy_work/ana_tencent_data_movie.sh
格式为:
* * * * * command
分 时 日 月 周 命令
第1列表示分钟1~59 每分钟用或者 /1表示
第2列表示小时1~23(0表示0点)
第3列表示日期1~31
第4列表示月份1~12
第5列标识号星期0~6(0表示星期天)
第6列要运行的命令
输入crontab -l 为查看有哪些定时任务
阅读全文
0 0
- Linux Crontab 定时任务
- Linux 定时任务 crontab
- Linux 定时任务 crontab
- Linux Crontab 定时任务
- Linux Crontab 定时任务
- linux 定时任务crontab
- linux 定时任务crontab
- linux定时任务 crontab
- linux 定时任务 crontab
- Linux - crontab(定时任务)
- linux crontab定时任务
- linux----crontab----定时任务
- Crontab Linux 定时任务
- linux定时任务--crontab
- linux定时任务crontab
- Linux定时任务crontab
- Linux定时任务crontab
- linux crontab 定时任务
- Zwj的图床
- 协方差矩阵
- 扩展ThreadPoolExecutor的一种办法
- CF16E Fish(概率dp+状压dp)
- 给绑定函数添加参数
- linux--crontab 定时任务
- 微信小程序URIError: URI malformed
- IE6bug汇总
- [学习][SCOI2005][bzoj1085]迭代加深 骑士精神
- Immutuable Object
- linux命令使用
- keras使用GPU
- JLOI2013(BZOJ3193)“地形生成”
- mui侧滑菜单点击菜单触发主页面内容变化