cron

Setting up a Laravel cron job in cPanel

旧城冷巷雨未停 提交于 2021-01-03 01:31:13
问题 I have the following function: protected function schedule(Schedule $schedule) { $schedule->command('email:users')->everyMinute(); } when I run the command artisan schedule:run it sends an email but when I add the following command to the cpanel as a cron job it doesn't send any email. Cpanel suppose to email me a notification when the cron job is run but I haven't receive a single email. php /home/rain/artisan schedule:run 1>> /dev/null 2>&1 Where am I doing wrong? Also when I run the

SpringBoot定时任务

[亡魂溺海] 提交于 2021-01-02 08:03:50
一、Scheduled定时任务   Scheduled定时任务器,是Spring3.0后自带的一个定时任务器。 maven中添加相关库 1 <dependency> 2 <groupId>org.springframework</groupId> 3 <artifactId>spring-context-support</artifactId> 4 </dependency> 编写定时任务类 1 @Component 2 public class ScheduledConfig { 3 @Scheduled(cron="0/2 * * * * ?" ) 4 public void scheduledMethod() { 5 System.out.println("触发了定时任务" ); 6 } 7 } 在启动类中开启scheduled 1 @SpringBootApplication 2 @EnabledScheduling 3 public class App { 4 public static void main(String[] args) { 5 SpringApplication.run(App. class , args); 6 } 7 } 二、cron表达式   Cron 表达式是一个字符串,分为6 或7 个域,每一个域代表一个含义   Cron 有如下两种语法格式:

分布式任务调度框架xxljob2.2.0详细安装使用教程

心已入冬 提交于 2021-01-01 18:02:08
分布式任务调度框架xxljob2.2.0详细安装使用教程 简介 概述 特性 总体设计 源码目录介绍 “调度数据库”配置 架构设计 设计思想 系统组成 架构图 安装 环境 创建目录 下载 解压 初始化调度数据库 调度数据库表说明 配置部署"调度中心"(xxl-job-admin) 修改application.properties配置文件 修改logback.xml(指定xxl-job的日志路径) 配置部署"执行器项目" 修改执行器配置文件 修改logback.xml(指定xxl-job的日志路径) 打包部署项目 启动 启动调度中心 启动执行器 加入systemctl管理并设置开机自启动 创建启动调度中心的启动脚本 将调度中心加入systemctl管理 创建xxl-job-admin.service服务文件 重新加载服务列表 启动服务 将调度中心设置为开机自启动 创建启动执行器的启动脚本 将执行器加入systemctl管理 创建xxl-job-executor.service服务文件 重新加载服务列表 启动服务 将执行器设置为开机自启动 开发第一个任务“Hello World” Gule模式 BEAN模式 BEAN模式(类形式) 第一步:执行器项目中,开发Job类 第二步:调度中心,新建调度任务 BEAN模式(方法形式) 第一步:执行器项目中,开发Job方法 第二步:调度中心

Ansible运维的必备工具

折月煮酒 提交于 2021-01-01 05:55:30
Ansible是新出现的自动化运维工具,基于Python开发,集合了众多运维工具(puppet、cfengine、chef、func、fabric)的优点,实现了批量系统配置、批量程序部署、批量运行命令等功能。 ansible是基于模块工作的,本身没有批量部署的能力。真正具有批量部署的是ansible所运行的模块,ansible只是提供一种框架。主要包括: (1)、连接插件connection plugins:负责和被监控端实现通信; (2)、host inventory:指定操作的主机,是一个配置文件里面定义监控的主机; (3)、各种模块核心模块、command模块、自定义模块; (4)、借助于插件完成记录日志邮件等功能; (5)、playbook:剧本执行多个任务时,非必需可以让节点一次性运行多个任务。 一、系统安装 [root@centos6 ~]# cat /etc/issue CentOS release 6.5 (Final) [root@centos6 ~]# uname -r 2.6.32-431.el6.x86_64 二、软件安装 [root@centos6 ~]# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm [root@centos6 ~]#

【树莓派】-bash: /usr/local/java/jdk1.8.0_161/bin/java: cannot execute binary file: Exec format error

纵然是瞬间 提交于 2020-12-31 03:16:10
遇到这样的问题:-bash: /usr/local/java/jdk1.8.0_161/bin/java: cannot execute binary file: Exec format error 原因是: 在 64 位的 Linux 系统中安装了 32 位的 JDK 环境,当前linux系统和所装的kdl版本之间不一致导致。 最简单的解决办法如下: # vim /etc/profile 在文档最后,添加: export PATH="/usr/local/src/java/bin:$PATH" 保存,退出,然后运行: #source /etc/profile vi /etc/profile JAVA_HOME=/usr/local/jdk1.8.0_161 CLASSPATH=.:$JAVA_HOME/lib/tools.jar PATH=$JAVA_HOME/bin:$PATH export JAVA_HOME CLASSPATH PATH 或者: export JAVA_HOME=/usr/local/jdk1.8.0_161 export CLASSPATH=.:$JAVA_HOME/lib/tools.jar export PATH=$JAVA_HOME/bin:$PATH 对于用户的SHELL初始化而言是先执行/etc/profile,再读取文件/etc

Linux日志系统分析:rsyslog、syslog和klog

孤街醉人 提交于 2020-12-30 03:00:00
参考博客:   https://blog.csdn.net/lidonghat/article/details/55004280   https://blog.csdn.net/u012247418/article/details/83684052 1.syslog是 Unix 系统的一个常见组件,用于执行系统日志记录活动。 2.syslogd 是它的守护进程,syslogd 从一组日志源(如 /dev/log 和 /dev/klog )中读取数据,并按照 /etc/syslog.conf 中的说明处理这些日志消息。通过调用syslog(),可将应用程序日志消息记录到 syslog 中。syslog 消息采用一种包含可选优先级和设备的标准格式。优先级指示消息的紧急程度,设备指示发布消息的子系统。/usr/include/syslog.h中定义了它的优先级和设备资源。 3.klog是一个从Unix内核接受消息的设备,klogd 守护进程获得并记录 Linux 内核信息。通常,syslogd 会记录 klogd 传来的所有内核信息。 kernel---> 物理终端(/dev/console) --> /var/log/message 命令dmesg 就是控制台输出/var/log/message日志信息 /sbin/init   /var/log/message: 系统标准错误日志信息

cron expression parsing into java date

╄→гoц情女王★ 提交于 2020-12-29 03:45:31
问题 my database having 10 18 16 ? * SUN,MON,WED,FRI * cron expression then how to convert into Java date. how to comparing with present day time. and one more is how to compare to cron expressions i.e. 10 18 16 ? * SUN,MON,WED,FRI * and 0 30 9 30 * ? please explain the sample code using quartz or spring scheduling. 回答1: Please use: import org.springframework.scheduling.support.CronSequenceGenerator; final String cronExpression = "0 45 23 * * *"; final CronSequenceGenerator generator = new

cron expression parsing into java date

余生长醉 提交于 2020-12-29 03:42:31
问题 my database having 10 18 16 ? * SUN,MON,WED,FRI * cron expression then how to convert into Java date. how to comparing with present day time. and one more is how to compare to cron expressions i.e. 10 18 16 ? * SUN,MON,WED,FRI * and 0 30 9 30 * ? please explain the sample code using quartz or spring scheduling. 回答1: Please use: import org.springframework.scheduling.support.CronSequenceGenerator; final String cronExpression = "0 45 23 * * *"; final CronSequenceGenerator generator = new

shell script to create folder daily with time-stamp and push time-stamp generated logs

北慕城南 提交于 2020-12-28 21:11:57
问题 I have a cron job which runs every 30 minutes to generate log files with time-stamp like this: test20130215100531.log, test20130215102031.log I would like to create one folder daily with date time-stamp and push log files in to respective date folder when generated. I need to achieve this on AIX server with bash. 回答1: Maybe you are looking for a script like this: #!/bin/bash shopt -s nullglob # This line is so that it does not complain when no logfiles are found for filename in test*.log; do

shell script to create folder daily with time-stamp and push time-stamp generated logs

陌路散爱 提交于 2020-12-28 21:09:37
问题 I have a cron job which runs every 30 minutes to generate log files with time-stamp like this: test20130215100531.log, test20130215102031.log I would like to create one folder daily with date time-stamp and push log files in to respective date folder when generated. I need to achieve this on AIX server with bash. 回答1: Maybe you are looking for a script like this: #!/bin/bash shopt -s nullglob # This line is so that it does not complain when no logfiles are found for filename in test*.log; do