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

learn more… | top users | synonyms (1)

15
votes
2answers
10k views

How can I tell cron to run a command every other day (odd/even)

When configuring cron to run a command every other day using the "Day of Month" field, like so: 1 22 */2 * * COMMAND it runs every time the day of month is odd: 1,3,5,7,9 and so on. How can I ...
2
votes
3answers
1k views

Solaris: how to forward cron e-mails?

If a cron job produces output it is e-mailed to the user's account. I would like to redirect this e-mail to another e-mail account. Preferably on a user-by-user basis. I've looked into some options ...
2
votes
1answer
137 views

Solaris cron ignoring mail aliases?

As a Solaris user, I want cron jobs generated emails for the localuser@server to be forwarded to my myuser@sample.com email account, so that I read only one inbox. To resolve this I have forwarded ...
9
votes
1answer
171 views

Finding which cron jobs are scheduled to run at some future date/time X

Is there a way to "query" a crontab to find which cron jobs run at some arbitrary date/time, or during a certain range of times? For example, determine which will be run at sometime between 14:00 and ...
0
votes
1answer
52 views

don't log cron events in auth.log

In my /etc/rsyslog.conf, I have following line to log auth facility into /var/log/auth.log: auth,authpriv.* /var/log/auth.log but the file is flooded with cron logs, sucgh as these: ...
2
votes
3answers
904 views

Crontab entry with hour range going over midnight

Is this valid crontab time specification, doing what is expected: 0 22-4 * * * Or is it necessary to do something like 0 22,23,0,1,2,3,4 * * *
5
votes
1answer
1k views

Running cron script with lynx fails to work

I'm trying to automate a login process that can only be done through a browser. I am using the lynx browser to script the actions required to do this. Lynx does this by dumping a user's keystrokes ...
2
votes
1answer
141 views

where does Cron look for the default mail binary?

I have setup Cron Jobs to run inside a Chroot Environment, depending on the User/Group; I have noticed that these cron jobs, running inside the chroot environment, fail to send any mail. Log files ...
0
votes
2answers
52 views

Write log for a false statement of an if condition which returns exit 2

I have a script running every 5 mins with two exits in a condition clause. #!/bin/bash date=$(date +%Y) if [ $date -eq '2014' ] then echo "Current year is $date" exit 0 else echo "Current ...
1
vote
2answers
578 views

Script runs manually but not from cron

As per the monitoring of my mysql replication status. I wrote a simple shell script with the following code #!/bin/bash date > /tmp/mysql_repl_status.txt cd /usr/bin/ "/usr/bin/mysql" "-e" "SHOW ...
5
votes
3answers
817 views

Crontab job not emailing on failure

I have a cron job on Debian: 1 * * * * /home/paradroid/bin/myscript.sh >/dev/null There is an installed and configured MTA, and I have received emails when the script has a syntax error, so I ...
4
votes
2answers
156 views

Execution order with multiple commands

I'm relatively new to Linux and I'm working on a CronTab for scheduled backups. I figured out how to do multiple sequential jobs with ; and &&, but I'm unsure how the dependency affects the ...
1
vote
2answers
71 views

Where is the cron information stored on my gentoo system?

I have a Linux gentoo system, which performs a cronjob every day at 3:10 in the morning. However, no file in /etc contains any related information to this particular cronjob, and the result of crontab ...
1
vote
1answer
104 views

Crontab does not run?

crontab -e 0 */4 * * * root /usr/bin/rsnapshot hourly 30 3 * * * root /usr/bin/rsnapshot daily 0 3 * * 1 root /usr/bin/rsnapshot weekly 30 2 1 * * root /usr/bin/rsnapshot monthly tail ...
0
votes
3answers
1k views

Custom crontab does not work (FreeBSD)

I created file crontab.custom with: */1 * * * * /home/username/data/www/run.sh And run.sh contains: php script.php After this I run this command crontab crontab.custom. Now crontab -l ...
6
votes
1answer
2k views

Recover cron jobs accidently removed with crontab -r

I entered crontab -r instead of crontab -e and all my cron jobs have been removed. What is the best way (or is there one) to recover those jobs?
0
votes
2answers
2k views

create a cronjob to run php script

I've created a cronjob in Xubuntu to run a PHP script in every 5 minutes. I did it as follows. I entered the following command: $ crontab -e Then entered the following: */5 * * * * /usr/bin/php ...
3
votes
2answers
103 views

Detecting cron tasks run by another user

I am currently working through the Nebula challenges on exploit-exercises.com, and one of the challenges relies on a script being run by cron. This is run by another user (flag03) and the user I am ...
34
votes
8answers
62k views

Where are cron errors logged?

If I setup cron jobs incorrectly they appear to silently fail. Where should I look for an error log to understand what went wrong?
5
votes
5answers
2k views

How can I use cron to display messages on the screen via notify-send

I am toying around with notify-send and cron (on an Arch machine) and I can't figure out a way to combine them: I tried the solution given here and here, but neither worked. How can I use them? ...
-1
votes
1answer
80 views

Cron spamming because of renice [closed]

I have a bash script that I execute using cron. The script begins like this: #! /bin/bash DIR=/home/pi/bin/run renice 19 -p $$ ionice -c 3 -p $$ : Now, every time cron runs this script it sends ...
4
votes
2answers
477 views

why doesn't 0 0 * * 1 root hostname >> /tmp/hostname.txt work as a crontab?

0 0 * * 1 root hostname >> /tmp/hostname.txt The above cron entry should run midnight on monday and create a file in /tmp called hostname.txt with the output of the hostname command. But it is ...
2
votes
1answer
147 views

How do I set cron to run on background?

I am on ubuntu 12.04 and following this tutorial. I want to setup cron to run in the background but I don't have a chckconfig in sbin so I can't run sudo /sbin/chkconfig crond on I am fairly new to ...
1
vote
1answer
231 views

Shell script and crontab to capture file size, name and date in a CSV file and then send via email?

I have a number of zip files in a certain folder. I want to capture file name and the size of the files in a CSV format in day wise and put it in crontab so I can report on a daily basis, and then ...
2
votes
1answer
103 views

Logrotate behaving unexpectedly

Find below the logrotate configuration that I'm using /usr/local/nagios/var/nagios.log { copytruncate daily rotate 7 compress missingok size 100M } And I could notice that ...
3
votes
1answer
123 views

Crontab suspicious activity

I tried using crontab -l from my terminal as root, it showed no crontab for root. So I tried crontab -e, it returns the following no crontab for root - using an empty one 888 and then the ...
2
votes
1answer
43 views

XML command line tool postgres

I have an XML files to read and load into database daily at night (cron) So i planed to do this in a batch. Is there any command line tool to : 1. Create a postgres schema using an XSD file? 2. ...
0
votes
0answers
247 views

Using gpg-agent to decrypt password in cron job

I have two scripts that both need to decrypt passwords using gpg-agent. Both of them run fine when launched from the terminal. The problem is that when run via cron, they both fail with these ...
0
votes
2answers
4k views

Run a script at startup

I am using Ubuntu 14.04. I wrote a small script named trial. The contents of the script are as follows: #!/bin/sh SHELL=/bin/sh PATH=/bin:/sbin:/usr/bin:/usr/sbin sh -c firefox I copied the ...
1
vote
1answer
465 views

debian7 cron.allow & cron.deny files

Almost 3 weeks that, in my downtime, I try to find out where the files cron.allow & cron.deny are located in debian7 distro. No way, it seems that by default they are not in the system. 'Just' ...
18
votes
4answers
881 views

Path independent shebangs

I have a script that I want to be able to run in two machines. These two machines get copies of the script from the same git repository. The script needs to run with the right interpreter (e.g. zsh). ...
4
votes
1answer
232 views

BASH_ENV and cron jobs

I have several questions related to non-interactive, non-login shells and cron jobs. Q1. I have read that non-interactive, non-login shells only "load" $BASH_ENV. What does this exactly mean? Does ...
0
votes
0answers
77 views

Fetching all Git repositories in the background

I'm thinking about setting up a cronjob for fetching all my repositories every once in a while, to have the current status ready in case I'm offline. Something like the following (wrapped for better ...
2
votes
2answers
620 views

Logrotate doesnt start proftpd triggerd by cronjob

Im currently running of ideas. The proftpd doesn't restart, if logrotate is triggered by the cron task. Logrotate rotates all logfiles stops proftpd but does not start proftpd again. If i force the ...
1
vote
0answers
84 views

Cron job running but not establishing tunnel

I have a script which establishes a reverse tunnel on an endpoint HostB. It looks like this: cat tun.sh #!/usr/bin/env bash # Test code /usr/bin/ssh -V 1> /home/userA/bin/tun.stdout 2> ...
0
votes
0answers
126 views

filter cron emails through procmail?

I'm using postfix/mutt/procmail on a Linux/Debian and I've some trouble filtering cron emails with procmail, I just want to move them to the cron/ maildir directory, but no lucky till now. I've ...
0
votes
1answer
136 views

How to force crontab to check for changed files

I have a gentoo Linux system in which I am logged in as root. How can I force crontab to read new/changed files in /etc/cron.d immedeately, so that even a new cronjob is executed if even only seconds ...
3
votes
2answers
438 views

crontab exclude specific date only

How can I write a cron that will exclude a specific date. let say : I need to run a crontab 6pm to 9pm in every 30 min on weekends and want to exclude 10th may 2014 only. Is It possible? How can I ...
2
votes
1answer
555 views

Script to check a folder, print the files then delete those files

I am looking for some guidance on creating a script that will check a specific folder, print all documents (if any) and then delete those documents. I would also like to run this script as a cron job. ...
2
votes
1answer
36 views

Conflict between cron.deny and allow who wins?

which one wins in conflict deny or allow? Is the behavior the same for hosts.allow and all the other similar files?
3
votes
3answers
718 views

Bash script to delete a file called index.html recursively

I need a bash script (not sure how to write the actual .sh file) which I could set to be run by cron every minute and that would delete files with the name index.html that are in a specific directory ...
2
votes
1answer
225 views

kill process in script while writing file behavior

in my php script which runs as a cron job, I have foreach($sites as $site) { exec('./wkhtmltoimage-amd64 ' . $site . ' somefile.png'); exec('./zopflipng -y somefile.png somefile.png'); } ...
1
vote
2answers
49 views

cronjob time 13 * * * *

It surely going to sound like a silly question but i wanted to have a confirm about that crontab time 13 * * * * does it really mean to launch at the 13th minute of every hr of every day of every ...
1
vote
0answers
150 views

Incrontab does not execute command

When I use incrontab out of the box, I mean no changes, I get no result, as if the command was not executed. my incron line is : /crrae IN_CREATE,IN_CLOSE_WRITE,IN_MOVED_TO /usr/bin/unix2dos $# the ...
4
votes
2answers
915 views

System Crontab or Root Crontab

System crontab: /etc/crontab Root crontab: sudo crontab -u root -e Which way is preferred? As they all run tasks within administration privilege.
3
votes
2answers
1k views

Automating backups run from a bash script in Linux the right way

I have a bash script I wrote to backup a Moodle installation. It works fine, I've tested the backups, but there's a problem with it; when I do the backups, since I have to use sudo to type the ...
2
votes
1answer
1k views

Executing PHP with CronJobs in CentOS 6.4 not working?

So I've spent around 2-3 hours now and some times researching, I found several of the same responses online but none seem to work! I'm trying to execute a PHP script every minute (as a test), but it ...
-1
votes
1answer
409 views

How to set up a cron entry that runs at 00 and 30 after the hour?

I have a cron entry that runs every 30 minutes - */30 * * * * /home/myuser/myscripts.sh How to set this up such that it runs exactly at 30 minute intervals but also exactly at (for example) 3:00 ...
1
vote
2answers
141 views

Running a cron job from another shell

I would like cron to run a script from a specific shell (Zsh). I thought the following would work: 00 02 * * * exec zsh; /path/to/script.sh but apparently it doesn't, why? This also made me ...
1
vote
0answers
27 views

How to block the user for a certain amount of time

Suppose, I am working in X environment, and I want to have an obligatory periodic rest. Is it possible to setup a root cron job, that will block my user for 5 minutes every 45 minutes? I am using ...