Cron is a job scheduler that allows users to run commands periodically.

learn more… | top users | synonyms (1)

1
vote
3answers
38 views

Getting crontab events that would happen given a start date/time

Let's suppose we have a crontab scheduling some commands on an RPi project, and these commands toggle a status of a flag. The box could go out of power, and then reboot. I want to have the flag status ...
1
vote
2answers
35 views

Put two Cron jobs into crontab using wget

I am trying to put these two Cron Jobs: 0 3 * * * ! sudo -u asterisk /var/lib/asterisk/bin/module_admin --repos extended,standard,unsupported upgradeall 30 3 * * * ! sudo -u asterisk ...
40
votes
11answers
23k views

Correct locking in shell scripts?

Sometimes you have to make sure that only one instance of a shell script is running at the same time. For example a cron job which is executed via crond that does not provide locking on its own (e.g. ...
1
vote
1answer
23 views

How is this crontab interpreted “*/N * * * *” where N is between 31 and 59?

If I need to run jobs exactly every 50 minutes, example. 00:50 run 1 01:40 run 2 02:30 run 3 03:20 run 4 04:10 run 5 05:00 run 6 06:50 run 7 Will */50 * * * * cron work as expected?
2
votes
1answer
41 views

Difference between CRON tab 0/5 and */5?

The title says it all is there any difference between creating a CRON tab using 0/5 and */5? For example: 0/5 * * * * vs */5 * * * *
0
votes
1answer
29 views

Cron not working at startup, but works if restarted?

For some testing, I need to reboot my system every minute. I have a busybox based system, installed cron using opkg. I setup a cron job using crontab, everything looks ok: root@SL1000-1103DC:~# ...
2
votes
3answers
3k views

Stop cron sending mail for backup script?

I have set up a backup script to back up world data on my Minecraft server hourly using cron, but because the worlds being constantly edited by players, tar was telling me that files changed while ...
1
vote
2answers
55 views

about executing a python program in a shell script which is scheduled on crontab

i have a problem with regards on crontab. I have a script named checker.sh and i want to schedule it that would run every minute: * * * * * sh /home/pi/checker.sh so i have the script here: the ...
1
vote
0answers
28 views

Send email on every change of service status

I am running a Debian server and i have setup mailutils to send an email from command line from root@localhost to an external email. I would like to slightly modify it, so it can send emails on every ...
1
vote
1answer
33 views

Loading crontab from file at startup

I'm starting machines from an AMI (Amazon Machine Image) on AWS (Amazon Web Services) and want to load the crontab dynamically from a file instead of using the AMI's crontab. One approach I thought ...
0
votes
1answer
192 views

nginx logrotate error on cron job

I'm running Ubuntu 14.04 LTS and nginx on a Digital Ocean VPS and occasionally receive these emails about a failed cron job: Subject Cron test -x /usr/sbin/anacron || ( cd / && run-parts ...
3
votes
1answer
126 views

Regex for crontab validation

I need to check in bash whether an entry into the crontab file is valid. Is there a crontab command switch? I can extract individual lines and try to control individual items through regex. But I ...
1
vote
1answer
95 views

How to activate Virtualenv when a Python script starts?

I want to schedule a python script to run using cron on certain dates, the problem is that in order for example.py to work, example-env has to be activated, is there a way to make example.py activate ...
0
votes
3answers
53 views

Cron job not saving

I'm trying to write a very basic cron job but it doesn't seem to be saving. Here's what I've done: 1) crontab -e This opens up a file with vim. 2) #!usr/bin/env python 0 23 * * 0 ...
0
votes
1answer
61 views

tput: No value for $TERM and no -T specified

I am trying to run a bash script I have via cron, and I am getting the following error at the beginning of the execution: tput: No value for $TERM and no -T specified Here is what is in my crontab: ...
1
vote
1answer
37 views

Adding a crontab - syntax

crontab -l | { cat; echo "0 0 * * * /path/to/cron/job"; } | crontab - I took this line from the net, to add a new cron job. It works well and good. I got the doubts, 1) Why do we need the curly ...
1
vote
1answer
27 views

How to redirect tarsnapper output to /dev/null?

I use tarsnapper's make command for managing tarsnap backups like this: tarsnapper -c /usr/local/etc/tarsnapper.conf make Which works like it should and I get an output like this Creating backup ...
2
votes
1answer
41 views

How to schedule shutdown every day?

We have a server that is used for Linux thin clients in a class. The server is started when required and I want to schedule it to power off at 22:00 every day to avoid power wasting. I thought of ...
2
votes
1answer
78 views

Creating a cron job and watching its output in real time

When I look at the questions and answers on this forum, it seems like the threshold to ask a question is very high. At least for someone like me, with very little knowledge of Linux. Most of the ...
0
votes
1answer
56 views

what is the difference between cron and systemd ?

what is the difference between cron and systemd ? Why we can't use use only one of this two?
1
vote
2answers
177 views

How to set up cron job in Linux to delete all regular files?

I need to set up a job to delete all of the regular files in the /home/admin directory on the second day of every month at 8:30 A.M. It seems like wrong command: # crontab -e 30 08 02 * /bin/find ...
1
vote
2answers
13k views

running a script every 30 minutes with crontab using ROOT (Debian)

When I manually type: root@username:~# ./myscript.sh the script executes, however I tried the following combinations to have crontab execute myscript.sh every 30 minutes (forever) and none seem to ...
1
vote
1answer
65 views

Skip syslog/rsyslog logging of certain cron jobs

In most GNU/Linux distributions the default is to log start (and many different events) of every cron job to syslog. It's rather convenient, but not for a very frequent jobs, which started, say, every ...
1
vote
2answers
53 views

CRON Job To Execute Command On Low Memory

I have a situation where I may need to execute an SAP command line tool hdbsql when memory gets too low (to help clean out the HANA table cache). I'm not well versed in Unix/Linux, and was wondering ...
2
votes
1answer
164 views

Task not run by crontab

crontab strangely does not execute my script, although the script is running just fine from the shell terminal. I already made sure that scripts are separated from each other by a new line space. ...
0
votes
1answer
52 views

Running a ruby cron job

I was trying to create a cron job which runs a ruby code on digital ocean, however it seems I'm making a mistake. It doesn't give any error but it doesn't also do anything. I ran this cronjob on my ...
2
votes
3answers
75 views

Only allow process to run between hours x and y

I use a mobile data connection service. I only have unrestricted bandwidth between 9am and 4pm. I wonder how I can "silence" applications such as the Dropbox applet outside that schedule. I thought ...
0
votes
3answers
58 views

how to tell crontab to execute the command from now instantly

I have a command in "/etc/crontab" which runs a database program every 7 days. Now, I see that this command has been commented by another user for 2 weeks. I immediately uncommented the line, and ...
7
votes
4answers
18k views

Cron running job every 15 seconds

Could you advise me what to write in crontab so that it runs some job (for testing I will use /usr/bin/chromium-browser) every 15 seconds?
0
votes
1answer
32 views

Checking the schedule of a cronjob and doing a conditional check on specific parts

Edit: I managed to solve this myself, I actually deleted my original question as I was over complicating the process slightly, but have since answered it in case others find it useful. RegExp is not ...
1
vote
2answers
492 views

Run A Cron Job Task Every 30 Seconds [duplicate]

It's possible to set the cron job tool in my website cpanel 'VPS Hosting' to execute php file every 30 second I am using it to execute php file once at a minute *,*,*,*,* but I need to set it to run ...
0
votes
1answer
53 views

help with remote file find/scp

I have a set of files on a remote sftp which I need to download to a server every day. sftp uses ssh keys to authenticate, so I created a ssh key and added to the remote server authorized folder. I'm ...
1
vote
4answers
104 views

How to stop minute cron job?

I have a program written in python; my program scrapes a value from some financial website every minute and pushes that value into my DB. My program takes like 1 or maximum 1.5 seconds to do this ...
0
votes
1answer
80 views

Cron Job every 55 minutes [duplicate]

I want cron to be run in every 55 mins. I followed the link CronJob every 25 minutes and my crontab command is */5 * * * * [ $(( $(date +%s) / 60 % 55 )) -eq 0 ] && wget ...
1
vote
1answer
79 views

Issue Using Crontab to Create/Restart Screen and Run Command

I want to have a certain script (rails rake task) running on my server at all times - it basically populates my DB using a live feed. I can create a screen (http://linux.die.net/man/1/screen) and run ...
0
votes
3answers
98 views

Cron job to run every minute from 11PM to 6AM

I have a python program which I need to run every minute from 11PM (EDT) to 06AM (EDT). How can I schedule a cron job to do this? * 23-6 * * 1-5 python my_program.py will this work? or do I have to ...
-1
votes
1answer
80 views

how to prevent cron job email splitting into multiple lines

CRON has emailed me the extract below : May 12 04:27:54 rpi postfix/smtpd[9343]: NOQUEUE: reject: RCPT from unknown[95.211.213.214]: 504 5.5.2 <WIN-HBAL58UG0JH>: Helo command rejected: need ...
1
vote
1answer
94 views

How to do version-control repository update in crontab?

I'm trying to automate version-control repository update in crontab. The following script /home/usr/mrbean/bin/update.sh works in interactive Bash command-line: #!/bin/bash ...
6
votes
1answer
67 views

How can I make `sudo crontab -e` use my `sudoedit` environment?

I've started using sudoedit <file> instead of sudo vim <file>. One of the advantages is that it uses my local ~/.vimrc. However, when using sudo crontab -e, it uses /root/.vimrc instead. ...
3
votes
3answers
4k views

Cron job to check if PHP script is running, if not then run

I am wondering if someone might point me in the right direction. I've got little experience working with the Linux command line and recently due to various factors in work I've been required to gain ...
0
votes
2answers
98 views

Cron job which runs every 5 seconds

I need to create an cron job with the following functionality: The job should go to a particular directory and touch one file every 5 seconds. It should run for only 1 minute. The logic is to ...
1
vote
1answer
40 views

Does systemd timer unit skip the next run if the process hasn't finished yet?

I want to use systemd to run a command every 5 minutes. However, there is a risk that occasionally the task may take longer than 5 minutes to run. At that point, will systemd start a second instance ...
0
votes
1answer
31 views

A generic cron wrapper that records all output

I am hoping to write a cron wrapper that records all output in a folder $CRON_LOG_DIR. It would be used as, e.g., follows: * * * * * $CRON_WRAPPER "<job name>" "command" which would record ...
1
vote
3answers
46 views

Cron job working, but crontab -l says no jobs

I am running raspbian on a pi and installed cron to schedule a job. I wrote a python script and I set it to run every 5 minutes. The job is happening every 5 minutes, no problems, but when I run ...
4
votes
1answer
75 views

high precision subsecond cronjob replacement

I am looking for a cron replacement which could run subsecond schedule, is there have any "still alive" project which serve this purpose? Currently running Ubuntu 14
0
votes
2answers
60 views

problem with cron job for every 2 minutes

I have a cron job for very 2 min and somebody told me that some servers do not allow 2 min cron jobs. basically from 30 min. it is true?
0
votes
2answers
5k views

What causes cron to continuously send mail and how can I disable it?

I have a problem on CentOS 6.3 system where the crond process tries to unsuccessfully send mail over and over (at least I think this is what its doing) until the OS eventually generates a "too many ...
11
votes
1answer
1k views

Suppress output unless non-zero exit code

What's the best way to suppress output (stdout and stderr) unless the program exits with a non-zero code? I'm thinking: quiet_success() { file=$(mktemp) if ! ( "$@" > "$file" 2>&1 ); ...
4
votes
2answers
259 views

Upgrading packages automatically

I'm fairly new to using servers (debian 7) and I'm currently running cron-apt to e-mail me when there are new upgrades available. Is the following command safe to run when new upgrades are shown? ...
12
votes
1answer
5k views

What's the meaning of the slash in crontab?

I have seen a crontab record in system. 0-55/5 * * * * root <command> I read the crontab -e example files and I know the first position stands for minute. But I cannot figure out the ...