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

learn more… | top users | synonyms (1)

6
votes
1answer
360 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
65 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
85 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
48 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
164 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
43 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
35 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
165 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
143 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
945 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
73 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
115 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
53 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
123 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
61 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
63 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
155 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
3answers
2k 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 ...
1
vote
2answers
43 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
98 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 ...
2
votes
1answer
31 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?
4
votes
2answers
91 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
517 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
219 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
174 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 ...
17
votes
4answers
804 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). ...
1
vote
2answers
79 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 ...
3
votes
5answers
800 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 ...
0
votes
0answers
236 views

why daily cron isn't running on CentOS 6?

I have a daily cronjob set up on CentOS 6 OS which should look after the log rotation job. The file is /etc/cron.daily/logrotate and it's contents are #!/bin/sh /usr/sbin/logrotate ...
1
vote
1answer
91 views

Why CRONTAB tasks are lost when quit Putty session? [closed]

I logged to remote computer, running under Solaris, using Putty and added some jobs to be run by cron. When I quit console and logged once again all jobs was lost. crontab -l myuser How do I ...
2
votes
1answer
236 views

Why do deleted files continually reappear?

I've been having a strange issue recently, where I would delete files from a location (i.e. Desktop), and then empty the Trash. However, a day or so later (I'm not sure exactly what triggers it), the ...
1
vote
1answer
176 views

automate updates with a bash script and cron

I'm trying to automatize the updates of debian system, without making upgrades. Then i'll send an e-mail to me, everytime there is an upgrade available. I've tryied to do it with cron-apt, but i ...
5
votes
0answers
175 views

CRON Permission Denied [closed]

I have a Debian 7. 3 Server with WebMin installed. I configured a cron job to run every minute as root user, so I run the command crontab -l when I'm logged in as root it shows: * * * * * ...
2
votes
1answer
67 views

How could I signal to a cron job to skip runs?

I have a cron job that runs every X mins and that I would like to have a way to "signal" it not to do anything if needed. Is there a standard way for this? The only idea I had is to check some ...
3
votes
2answers
151 views

Does cron know that the instance to be scheduled is already running?

I was wondering if we add a job in the crontab e.g. to run every 5 mins and the job does not actually manage to finish in 5 mins, does the cron daemon know that the previous instance is already ...
0
votes
1answer
212 views

Getting a Bad Hour Error in crontab

I am getting Bad Hour error for below peice of code in crontab */05 17-05 * * * wget -q -O /dev/null "http://abcd/cron/abcd" Is there any issue with this. I want the cron to run from evening 5 PM ...
0
votes
1answer
174 views

Cron task starts at 5:30 and runs every 5 mins once

I want to run a crontab cron job which start at 5:30 AM and runs every 5 mins. How do i set it up in Linux? I am able to give like below. But how do i make it 5:30 ? */05 5-16 * * *
2
votes
1answer
71 views

Accidentally typed crontab with just the dash

What happens when I type just "crontab -"? The "e" didn't take before I hit Enter. It just moved the cursor to the next line and I had to Ctrl+C to exit, but I'm not sure what it did exactly. I'm on ...
2
votes
1answer
454 views

cronjob for automatic DB backup to date prefixed file

I am using the latest Linux Mint. I was wondering if it's possible to create a special cronjob for a database backup. In my /etc/cronjob file I have the following code: # Minute Hour Day of ...
0
votes
1answer
92 views

Can continually assigning a variable in a shell script cause a memory leak?

I've written a short script to copy Apache's server status to a log: #Save date and time to a variable dt=$(date) #Echo date and time to the log file as it's not included in server-status echo "Time ...
1
vote
1answer
302 views

Cron: Client does not have permissions to send as this sender

Platform: Arch Linux Cron: cronie Mail: msmtp I discovered that sending cron output to a mailbox hosted by Office 365 produced the following error, even though sending mail through the CLI was ...
1
vote
1answer
138 views

Cron task in graphic interface

I need to open one (or more) browser tab periodically and I decided to use cron. The command in the shell (bash) that correctly executes this task is chromium-browser http://mysite.com. If I type it, ...
0
votes
2answers
77 views

How can I ensure that a custom environment variable is set before cron runs a task?

I recently experienced a logwatch issue that is fixed by running export DATE_MANIP=DM5. cron seems to forget this when I logout (presumably because it's not saved). Where can I add this custom ...
5
votes
3answers
177 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 ...
2
votes
1answer
88 views

cron midnight 00 24 or 00 00? [closed]

My current crontab looks like this: 00 00 * * 1-5 "/home/user/script.sh" But it seems like it is not being triggered, all others are triggering fine except the one running at midnight. What is the ...
3
votes
1answer
63 views

What's the easiest way to set up a 2-hour alarm?

I want my computer to play some given .mp3 every 2 hours. I want it to run at startup, and be modifiable with a given .conf file. The choice of .mp3 will also be in the .conf file. The reason is, I ...
3
votes
2answers
81 views

How to run a command as if it is called from cron

I write a script and set it as a cron job. But due to a difference of environment variables it doesn't work as it should be. In that case I change a little bit with crontab -e and set a cron job time ...
9
votes
1answer
192 views

Cronjob to Run and then Terminate

I want to add a cron entry that does something like: 00 00 * * * * /tmp/script.sh Is there something I can add to the end of the line, so that when it is finished, it will remove the line out of my ...