一、安装
安装:apt-get install cron
启动:service cron start
停止:service cron stop
状态:service cron status
查看:crontab -l
二、使用
1、 /var/spool/cron/crontabs下对应用户名文件添加需要定时跑的任务
0 */1 * * * sh /usr/spark/run.sh >> /usr/spark/run.log
2、 创建对应sh文件
#!/bin/bash
source /etc/profile
/usr/spark/spark-2.4.6-bin-hadoop2.7/bin/spark-submit --class com.celix.spark.WordCount --master spark://hadoop1:7077 /usr/spark/spark-2.4.6-bin-hadoop2.7/examples/jars/javajar/spark-1.0-SNAPSHOT-jar-with-dependencies.jar