crontab

Run cron every 5 minutes in specific time span

泪湿孤枕 提交于 2019-12-08 10:28:36
问题 I would like to run a cron job every 5 minutes in between these time span: Tuesday: 8pm - 10pm Wednesday: 8pm - 10pm Friday: 8.30pm - 10.30pm Saturday: 3.30pm - 5.30pm and 6.30pm - 8.30pm Sunday: 3.30pm - 7.30pm I guess I need more than one line to realize it. My current crontab looks like this: COMMAND=curl -u user:password http://localhost/webapp/cache/build/openligadb >> /var/log/cron.log # Tuesday + Wednesday 8pm - 10pm # m h dom mon dow command */5 20-22 * * 2,3 $COMMAND # Friday 8.30pm

how i can do a crontab as user on raspbian?

♀尐吖头ヾ 提交于 2019-12-07 21:52:52
问题 I'm on a raspberry pi, with rasbpian ! I'm trying to install a new crontab for execute an basic script. This one will take a picture from webcam with vlc. I want to do this every minute but i can't edit my crontab user (crontab -e), only the sudo crontab... Or vlc must do execute without root ! pi@raspberrypi ~ $ crontab -e crontabs/pi/: fdopen: Permission denied Every body know how i can do ? This is my script : #!/bin/bash cvlc -I dummy v4l2:///dev/video0 --video-filter scene --no-audio -

让crontab使用smtp服务器向管理员发送报错邮件

你说的曾经没有我的故事 提交于 2019-12-07 20:56:46
#前言# crontab有一个邮件发送的机制,如果crontab执行脚本时,stdout有输出时,会以邮件的形式发送到crontab当前用户,使用 mail 命令即可查看邮件。这些信息经常很有用,往往携带了错误信息,可以帮助管理员排错,因此管理员对于mail不可不关注。 注意 : 想要看到crontab报警邮件需要有邮件服务器,在centos/RHEL,ubuntu/Debian等主流发行版都会有一个 mailutils 软件包,这个软件包就二选一依赖于邮件服务端软件 postfix / sendmail 和客户端软件 mail (早一些的发行版,如centos/RHEL5 优先依赖 的是sendmail,centos6,ubuntu12.04等新一些的发行版, 优先依赖 的是postfix) 安装 mailutils 之后,默认配置即可收到crontab的邮件,使用mail命令即可看到邮件详情。 但当服务器比较多时,一台台ssh上去敲 mail 命令显然不合适,有没有方法能让crontab把邮件发送到管理员的邮箱呢?crontab已经有这种设定了。 研究了一天,google了一天老外的资料,眼睛都花了(希望自己动手解决的可以google一下各种关于crontab smtp之类的关键字,老外提到的基本集中在几个点),加上自己的各种尝试,总结方法如下: #MAILTO变量#

Cannot import mysql-python in crontab Mac OS

戏子无情 提交于 2019-12-07 20:48:46
问题 I wrote a script which runs ok, but when I run it from crontab I get an import error. Traceback (most recent call last): File "/Users/.../Desktop/test.py", line 3, in <module> import MySQLdb as mysql File "build/bdist.macosx-10.7-intel/egg/MySQLdb/__init__.py", line 19, in <module> File "build/bdist.macosx-10.7-intel/egg/_mysql.py", line 7, in <module> File "build/bdist.macosx-10.7-intel/egg/_mysql.py", line 6, in __bootstrap__ ImportError: dlopen(/Users/.../.python-eggs/MySQL_python-1.2.3

Edit crontab programmatically and force the daemon to refresh

隐身守侯 提交于 2019-12-07 20:33:25
I'm trying to write a web frontend for Crontab in Ruby using the excellent CronEdit gem. I went through Dillon Cron's crontab source code and found that it updates a particular file so that the daemon will refresh the cron list during the next sweep. In man crontab for VixieCron, it says: Additionally, cron checks each minute to see if its spool directory’s modtime (or the modtime on /etc/crontab) has changed, and if it has, cron will then examine the modtime on all crontabs and reload those which have changed. Thus cron need not be restarted whenever a crontab file is modified. Note that the

服务器被入侵了怎么办?

那年仲夏 提交于 2019-12-07 18:21:32
上个月末,我也尝试到了服务器被病毒入侵的滋味,正好这个月末来复盘一下。 怎么说呢,那个感觉就像是你自己的娃在外面被揍了一样,你得想办法为孩子出人头地呀,是吧。于是这一波病毒反击战就正式上演了。 ## 一出好戏 先说一下我是怎么发现服务器被入侵的。那是在一个愉快的下班时间,我的手机端又提示收到了阿里云的警告。因为之前我用物联网卡的缘故,而我的物联网卡归属地是在重庆,所以总是会导致阿里云警告我的服务器异地登录的情况出现。而这一次,看到警告信息和往常有点不一样,我就有点奇怪。但苦于我那会还不像现在这样可以天天拿着我的MBP回家,可以及时操作(虽说手机端也有连接命令行的工具,但是屏幕太小了),加上之前老是收到异地登录的警告,以为这次也不会出什么大事,所以我也就没继续在意。 令人恐惧的事发生在第二天上午我来上班的时候。我照常打开终端工具,熟练地连上阿里云服务器,发现这一次比平常要慢很多,因为昨天报警的事,我一度担心登不上去。不过还好,过了一会,总算登录上去了,这让我缓了一口气。但是噩耗再度传来,我发现无论我输入什么命令,终端上回显的速度都奇慢,我彻底慌了!一般出现这种问题,要不就是网络问题;要不就是CPU满了,导致服务器处理不过来。于是我使用`top`命令查看到底有什么进程在占用CPU,果然看到一个叫做watchbog(它竟然想伪装成watchdog)的进程占用了99.3%的CPU!![]

Is bash > redirection atomic?

删除回忆录丶 提交于 2019-12-07 16:25:28
问题 I've weird problem with my crontab job. My crontab job does the following: program > file Sometimes however file gets filled with random data that I can't explain. I wonder if it could be the previous crontab job that's taking longer to run and it somehow mixes its results in file with current crontab job? Overall my question is: is > operation atomic? Meaning if two programs do > file , then the last one to finish will have its data in file ? 回答1: No, it's not atomic. Not even a little bit

Running crontab with python

你离开我真会死。 提交于 2019-12-07 13:30:45
问题 Python crontab script doesnt seem to work. When i run it manually, python /home/ec2-user/code1.py it works fine but when put into cron.txt file for the crontab, doesnt. My crontab file is: @hourly python /home/ec2-user/code1.py >/dev/null 2>&1 i also tried 0 * * * * python /home/ec2-user/code1.py >/dev/null 2>&1 But neither have much luck. sudo crontab -l @hourly python /home/ec2-user/code1.py >/dev/null 2>&1 Shows everything functional. I tried Crontab not running my python script and couple

crontab is not running my script

久未见 提交于 2019-12-07 07:19:12
问题 I'm new to cron jobs. I read a post on how to write a cron job with crontab. So my crontab looks like this: 1 * * * * /Users/apple/Desktop/wget/down.sh which basically means that every minute i want to execute the script : down.sh . Now the script runs fine manually. The script is a simple program that downloads a PDF from the internet: #!/bin/bash wget -U Mozilla -t 1 -nd -A pdf "http://www.fi.usj.edu.lb/images/stories/HoraireS08/3eli.pdf" -e robots=off; I don't know why it's not running

Django celery crontab every 30 seconds - is it even possible?

℡╲_俬逩灬. 提交于 2019-12-07 04:39:43
问题 Is it possible to run the django celery crontab very 30 seconds DURING SPECIFIC HOURS ? There are only settings for minutes, hours and days. I have the crontab working, but I'd like to run it every 30 seconds, as opposed to every minute. Alternatively... Is it possible to turn the interval on for 30 seconds, and turn on the interval schedule only for a certain period of the day? 回答1: Very first example they have in the documentation is... Example: Run the tasks.add task every 30 seconds. from