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

learn more… | top users | synonyms (1)

-2
votes
1answer
13 views

Run job at boot and on a schedule from same crontab

I have a process that I need to run on boot and periodically. I've created a file for it in /etc/cron.d/. Is there a way for me to specify that I want @reboot 0,30 * * * *?
4
votes
2answers
203 views

Schedule job at irregular intervals

It's simple enough to use cron to schedule a job to occur periodically. I'd like to have something occur less regularly -- say, run the job, then wait 2 to 12 hours before trying again. (Any ...
1
vote
0answers
26 views

How to find out why my cron didn't run? [duplicate]

This is the content of root's crontab: 0 23 * * 0-4 /usr/sbin/rtcwake -time `date --date="+16 hours" +"%s"` -m mem This is set to fire off that command every Sun-Thu at ...
1
vote
1answer
23 views

bash script not being run by cron [duplicate]

I have a very simple bash script that runs flawlessly when I do ./removeOldBackup.sh or sh /home/myusername/backup/removeOldBackup.sh but when I add it to crontab like * * * * * sh ...
5
votes
3answers
167 views

Is any extended logging available for cron jobs?

I have 3 scripts under /etc/cron.daily. My cron logs are written in /var/log/cron. The below is an entry for the above cron that has run. (root) CMD (run-parts /etc/cron.hourly) Here the stdout or ...
4
votes
3answers
42 views

Cronjob to run script every 3 weeks on Wednesday

Is it possible to schedule a cron job that would run every three weeks on Wednesday (8AM) only? Or, if that is not possible, to run a job every 27 days or less but on Wednesday at 8AM.
1
vote
1answer
36 views

Why doesn't my supervisor daemon start on reboot?

I have added a crontab entry via crontab -e for the current user: @reboot supervisord -c /etc/supervisord.conf Yet after the reboot, supervisord demon is not running. I need to run the command ...
1
vote
2answers
43 views

How to determine the newly closed file within a continuous audit log rotation?

I am attempting to find the best way to determine when the second file (of a matching criteria) is created. The context is an audit log rotation. Given a directory where audit logs are created every ...
-1
votes
1answer
26 views

if condition failing in cron [closed]

I have the shell script shown below. It is running fine if I execute normally, but if I schedule it in a crontab, it is failing in "if condition". O.S : Ubuntu 11.04 script: set -x cd ...
0
votes
0answers
23 views

Anacron “Failed to determine timestamp: Cannot assign requested address”

I have created a custom cron job named "audit" in /etc/cron.daily. The cron job works perfectly and email me the server's status on a daily basis, except that it also keep sending me the following ...
1
vote
1answer
844 views

sh script will not execute as root (cron)

I have the following script added to cron. If I add touch thisisatest.file to the first line it will create a file named thisisatest.file, but not execute the rest of the code. If I manually type ...
1
vote
3answers
775 views

How do I find out why cron is not running my jobs?

I'm using Ubuntu 14.04, and the cron daemon is running: # ps ax | grep cron 822 ? Ss 0:00 cron but it is not executing any jobs. I was previously getting entries in /var/log/syslog such ...
3
votes
2answers
51 views

How to make Cron run

I am trying to set up cron to run the mysqlauditgrep command (its the MySQL 5.6 Utilities package). The mysqlauditgrep command is in bash. The command I am looking to run is: mysqlauditgrep ...
3
votes
2answers
450 views

Use /etc/aliases for outgoing mail relayed by postfix with local domain

I'm using Ubuntu 12.04 with postfix configured as satellite system that relays outgoing mail to Gmail. For sake of example, my registered domain is example.com I want root cronjobs' error output to be ...
1
vote
1answer
32 views

How to set up Cron to run mysqlauditgrep command for 11AM on Friday

I am trying to set up cron to run the mysqlauditgrep command (its the MySQL 5.6 Utilities package). The mysqlauditgrep command is in bash. The command I am looking to run is: mysqlauditgrep ...
1
vote
1answer
60 views

Logrotate does not work for httpd service [closed]

We have logrotate working for several Centos servers. One new server has a slightly different setup, and for some reason logrotate does not work for the httpd service. When I start it manually, it ...
0
votes
2answers
64 views

Unix 11i v2 Script to detect new files within directory

I was hoping someone can point me in the right direction. I would like to create a script to check for new files (files with today's date) within a directory and then print the results to a text file. ...
1
vote
1answer
33 views

Why isn't this crontab job running

I have a cron job that runs every minute on an Ubuntu 12.04 box $sudo crontab -e * * * * * mylogin /pathto/file.sh > /log/filelog If I run file.sh, the bash script does some stuff and echos out ...
1
vote
0answers
38 views

Permission denied when running logrotate with anacron

I am trying to figure out what is causing anacron to send me the following error message: /etc/cron.daily/logrotate: /var/log/mariadb/mariadb.log-20140710.gz: Permission denied error: error running ...
3
votes
1answer
40 views

sudo source: command not found

I want to run this program as root. It activates a virtual environment and runs a python program in that virtual environment. The program looks like this $cat myfile.sh source ...
4
votes
1answer
50 views

Is it possible to put arithmetic expressions in a crontab?

I know I can do simple arithmetic in shell scripts, like so: #!/bin/bash ((sum = 1 + 2)) echo sum This will output 3 on execution. My question now is, can this kind of expressions be used in ...
-2
votes
1answer
35 views

How to send a message in Minecraft before rebooting the server? [duplicate]

I have a Ubuntu Linux Server 14.04 LTS which is running a Minecraft server. I want it to reboot every 6 hours. I have that now and after the reboot, it starts the Minecraft server. Now what I want. I ...
0
votes
1answer
39 views

Autodelete old files

I've many shares on my samba server with recycle bin module activated. When deleting remote files from Windows I see .Trash directory. I'd like to automatically remove older files, i.e. 30 days or ...
0
votes
3answers
1k views

Sending cron output to email?

I'm trying to send cron output to an email address and am struggling... I'm running the following command: 13 15 * * 1-5 root /path/to/mysql-backup.sh 2>&1 | mail -s "Daily Database Backup ...
2
votes
0answers
72 views

`crontab -e` sometimes fails with “Creation of temporary crontab file failed”

From time to time crontab -e fails on me on a Ubuntu box. It is the same for all users including the root and crontab -eu <user> under the root. Goes like this on a regular basis, a success here ...
1
vote
1answer
25 views

Add a custom CRON job from the command line?

Debian seems to have directories for cron jobs such as /etc/cron.daily and /etc/cron.hourly, but is there a way for me to automate editing, removing, and updating cron jobs from an automated script? ...
3
votes
5answers
594 views

bash restart mysql when it gone run well in SSH part, but not in cronjob

My system is centos 6.5, I write a simple bash shell to check if mysql is crashed, restart service again. I put it in /home/myspace/mysql.sh chown root:root /home/myspace/mysql.sh then run every ...
2
votes
3answers
49 views

Limit a text file to 100MB

I have several log files on my server that I would like to limit to 100MB large. I'm considering creating a cron job that will run once a month and remove the oldest characters (closest to the top) ...
1
vote
1answer
24 views

Insert variable and keep the variable

I'm on VMWare which, no matter what anyone says, responds to most unix commands. Some things are unique though, for example the fact that almost no files are persistent through reboot. Due to this ...
1
vote
1answer
127 views

Why does rsync look for DSA instead of RSA key when run from cron job?

I want to backup files from a server to my local computer using rsync. I can only log-in to the server with an RSA ssh key. I have stored the passphrase to the key in Seahorse Passwords and Keys, ...
14
votes
2answers
7k 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
884 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
54 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
90 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 ...
2
votes
1answer
23 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
561 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
14 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
27 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
60 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
772 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
98 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
34 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
26 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 ...
3
votes
1answer
271 views

Cron job to delete files older than 3 days

I need to remove files older than 3 days with a cron job in 3 different directories. (these 3 directories are children of a parent directory /a/b/c/1 & /a/b/c/2 & /a/b/c/3) Can this be done ...
0
votes
3answers
687 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
214 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
397 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
59 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 ...
28
votes
8answers
45k 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?