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

learn more… | top users | synonyms (1)

4
votes
2answers
29 views

Create new temporary directory

What's an effective way of creating a new /tmp directory, that behaves just like /tmp (purged on reboot, etc.), but in a different location? In my case, I want to create a ~/dev/tmp directory where I ...
0
votes
2answers
37 views

How to kill a process in shell script which is running through cron?

I have a shell script which runs in cronjob. This shell script has to kill a process which is running and start the new process again. When I run the script manually it works perfectly fine, but when ...
-2
votes
1answer
22 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
25 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 ...
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
37 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 ...
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 ...
1
vote
1answer
33 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
61 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
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 ...
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
0answers
39 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 ...
1
vote
1answer
34 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 ...
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 ...
1
vote
1answer
28 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? ...
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) ...
2
votes
0answers
73 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
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 ...
9
votes
1answer
91 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
24 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: ...
0
votes
2answers
28 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
64 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 ...
2
votes
1answer
15 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 ...
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
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 ...
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 ...
3
votes
1answer
304 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 ...
6
votes
1answer
222 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?
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 ...
2
votes
1answer
59 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 ...
27
votes
1answer
1k views

Why aren't crontabs stored in user home directories?

I'm curious to know: why are crontabs stored in /var rather than in the user's home directories? It makes it a total pain to isolate these files for upgrades but I suspect that there is a logical ...
-1
votes
1answer
43 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 ...
1
vote
1answer
133 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 ...
1
vote
1answer
35 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 ...
2
votes
1answer
33 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. ...
3
votes
1answer
110 views

Automatically detect when a file has reached a size limit

I would like to send an email when a file reach a certain size limit. The only way I thought of doing this is by doing a cronjob which will check the file size and send the email if the file is ...
0
votes
0answers
94 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
359 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 ...
3
votes
1answer
68 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 ...
1
vote
1answer
72 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' ...
0
votes
0answers
44 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 ...
4
votes
1answer
103 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 ...
1
vote
0answers
56 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
1answer
51 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 ...