cron

Jenkins Triggering of a Build Step/Stage(not the entire job) at a given interval

自古美人都是妖i 提交于 2021-02-05 09:45:34
问题 I am trying to build a pipeline where i would need to chain multiple jobs and some of them has to start at a certain time. Ex: Job1(starts at Midnight) -> Job2 -> Job3 ->Job4(starts at 4 PM) Using Declarative Syntax: pipeline { agent any stages{ stage('Fetch Latest Code-1') { steps{ build job: 'Get Latest - All Nodes', quietPeriod: 60 } } stage('CI Day - 1') { parallel { stage('ANZ CI'){ steps{ build job: 'ANZ - CI', quietPeriod: 120 } } stage('BRZ CI'){ steps{ build job: 'BRZ_CI',

how to detect failure and auto restart celery worker

只愿长相守 提交于 2021-02-05 08:35:59
问题 I use Celery and Celerybeat in my django powered website. the server OS is Ubuntu 16.04. by using celerybeat, a job is done by a celery worker every 10 minutes. sometimes the worker shuts down without any useful log messages or errors. So, I want to find a way in order to detect status (On/Off) of celery worker (not Beat), and if it's stopped, restart it automatically. how can I do that? thanks 回答1: In production, you should run Celery, Beat, your APP server etc. as daemons [1] using

Audio through Cron Job

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-04 20:59:19
问题 Does anyone know why audio wouldn't run through a cron job even though it runs perfectly fine when run through the command line. I have a python script that plays audio through a bluetooth speaker and when I run it on the command line (python helper.py) it plays fine, but running it through cron doesn't seem to work. Extra details: I am doing this on a Raspberry Pi that I have connected to a bluetooth speaker. I have a display connected to the raspberry pi (not doing it headless but that is

Is it possible to set a cron job or bash script to run X minutes from now?

寵の児 提交于 2021-02-04 20:50:22
问题 I understand I can set a cron job to run every 5 minutes with crontab -e by adding a line such as: */5 * * * * /path/to/script.sh . Is it possible to get the system time in minutes using date +"%M" for example, and then set a cron job to run at date +"%M" plus 5 minutes? I know I can get date +"%M" + 5 via the following process: $ MIN=`date +"%M"` $ export MIN $ expr $MIN + 5 Is it possible to use this to set a cron job or script to run at "current time in minutes" plus "X minutes"? I could

How to use at command to set python script execute at specified time

和自甴很熟 提交于 2021-02-04 19:55:33
问题 When I try to use cron to execute my python script in a future time, I found there is a command at, AFAIK, the cron is for periodically execute, but what my scenario is only execute for once in specified time. and my question is how to add python script to at command, also it there some python package for control the at command My dev os is ubuntu 10.04 lucid,and my product server is ubuntu-server 10.04 lucid version. in fact, I want through python script add python script tasks to at command

How to use at command to set python script execute at specified time

倾然丶 夕夏残阳落幕 提交于 2021-02-04 19:55:06
问题 When I try to use cron to execute my python script in a future time, I found there is a command at, AFAIK, the cron is for periodically execute, but what my scenario is only execute for once in specified time. and my question is how to add python script to at command, also it there some python package for control the at command My dev os is ubuntu 10.04 lucid,and my product server is ubuntu-server 10.04 lucid version. in fact, I want through python script add python script tasks to at command

Google App Engine - Securing url of cron python

孤人 提交于 2021-02-04 06:24:07
问题 I'm a newbie to google app engine. I want the security restriction for url of cron so that it shouldn't be accessible by url directly. For this I've already read the docs and some of Q&As ([Google app engine: security of cron jobs). I implemented the login : admin solution suggested in this link. But I failed to implement security as self.request.headers.get('X-AppEngine-Cron') is always None , whether it is cron or accessed via url directly. So I don't know from where is the request coming

日志系统rsyslog

一曲冷凌霜 提交于 2021-02-02 00:35:20
写在前面的话: 最近在看一本书,叫效率读书,其中讲述了两种思维,一种是发散性思维,一种是专注性思维,当我们在专注做一件事的时候,其实能持续的时间不是很长,大约在25分钟左右,如果时间过长,那么就会消耗很大,这个时候可以想想其他的事来分散一下注意力,也就是使用发散性思维,一般我是洗个澡,感觉洗了之后,思维比较清晰,各位也可以试试。 1、 前言 在操作系统中,存在着各种各样的事件,那么用什么来记录这些事件发生的时间和相关信息呢?那么就会用日志系统 rsyslog ( RHEL6.X )。 2 、 日志系统 在 RHEL5.X 的时候,使用的服务如下所示: [root@testDB ~]#ps -ef|grep -E "syslogd|klogd" ( RHEL5.X 记录日志信息服务 ) root 2994 1 0 Sep06 ? 00:00:01 syslogd -m 0 ( 记录非内核产生的信息 ) root 2997 1 0 Sep06 ? 00:00:00 klogd -x ( 记录 kernel 产生的信息 ) 在 RHEL6.X 的时候,使用的服务如下所示: [root@rsyncserverscripts]# ps -ef|grep rsyslogd ( RHEL6.X 记录日志信息服务 ) root 1662 1 0 01:17 ? 00:00:00 /sbin

日志rsyslog

丶灬走出姿态 提交于 2021-02-01 15:51:45
#(1)日志基础 ####1)简介 rsyslog:记录大部分与系统操作有关,例如安全,认证sshd,su,计划任务at,cron rsyslog日志可以存在本地,也可以存放在远程服务器 ####2)常见的日志文件 /var/log/messages //系统主日志文件 /var/log/secure //认证丶安全 /var/log/maillog //跟邮件postfix有关 /var/log/cron //crond,at进程产生的日志 /var/log/dmesg //和系统启动有关 /var/log/audit/audit.log //系统审计日志 /var/log/yum.log //yum日志 /var/log/xferlog //和访问FTP服务器有关 w //当前登录的用户 /var/log/wtmp last //最近登录的用户 /var/log/btmp lastlog //所有用户的登录情况 /var/log/lastlog ####3)例 统计登录失败的top5 ip地址 #grep "failure" /var/log/secure | awk -F'[ =]+' '{print $18}' | grep -v user | sort | uniq -c | sort -k1 -rn | head -5 统计登录成功的top5 ip地址 #grep

记一次 Linux 被入侵,服务器变“矿机”全过程

余生颓废 提交于 2021-01-30 09:34:14
周一早上刚到办公室,就听到同事说有一台服务器登陆不上了,我也没放在心上,继续边吃早点,边看币价是不是又跌了。 不一会运维的同事也到了,气喘吁吁的说:我们有台服务器被阿里云冻结了,理由:对外恶意发包。 我放下酸菜馅的包子,SSH 连了一下,被拒绝了,问了下默认的 22 端口被封了。 让运维的同事把端口改了一下,立马连上去,顺便看了一下登录名 :root,还有不足 8 位的小白密码,心里一凉:被黑了! 查找线索 服务器系统 CentOS 6.X,部署了 Nginx,Tomcat,Redis 等应用,上来先把数据库全备份到本地,然后 Top 命令看了一下,有 2 个 99% 的同名进程还在运行,叫 gpg-agentd。 Google 了一下 GPG,结果是: GPG 提供的 gpg-agent 提供了对 SSH 协议的支持,这个功能可以大大简化密钥的管理工作。 看起来像是一个很正经的程序嘛,但仔细再看看服务器上的进程后面还跟着一个字母 d,伪装的很好,让人想起来 Windows 上各种看起来像 svchost.exe 的病毒。 继续排查: ps eho command -p 23374netstat -pan | grep 23374 查看 pid:23374 进程启动路径和网络状况,也就是来到了图 1 的目录,到此已经找到了黑客留下的二进制可执行文件。 接下来还有 2 个问题在等着我