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

learn more… | top users | synonyms (1)

3
votes
3answers
5k views

linux cron: want to backup a folder

Hello I would like to backup a folder using cron on a centos. The folder c2duo_mms is located in /usr/local/src/djcode/c2duo_mms. I would like it backed ip every 1:00pm on Tuedays to my home folder ...
9
votes
2answers
1k views

How can I delete all files in a folder that haven't been accessed in a certain amount of time?

I'd like to run a nightly cron job that deletes all the files in a folder that haven't been accessed in a week or more. What is the most efficient way to do this in bash?
15
votes
2answers
9k 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 ...
4
votes
1answer
513 views

How can i dump /tmp/files in CentOS to Dropbox using crontab?

How can i dump files from my CentOS box to Dropbox account? As regular nightly backup task.
4
votes
3answers
6k views

Can I use logrotate to compress daily (date named) logs?

I have logs in the following format: YYYYMMDD I want to compress old logs (older then current day) and maybe move them to a different directory afterwards. Can I do this in logrotate, or do I have ...
2
votes
1answer
241 views

Can I bypass crontab command by putting the file?

I need to create and put my cron file with cat cronfile1 cronfile2 > cronfile crontab cronfile -u myuser This works for me, but I want to know if I can do directly cat cronfile1 cronfile2 > ...
2
votes
2answers
2k views

stop parallel processing for a cron triggered process

I have configured my webservers cron jobs to trigger some php script, every 15min, but sometimes the script takes morethan 15 min to complete execution, by the time another process of the same script ...
1
vote
1answer
159 views

How to list the actual cronjobs?

If I (e.g.: under Fedora) edit the crontab file with vim, then I restart crond: /etc/init.d/crond restart then the actual crontab file: "/etc/crontab" is the same as the actual cronjobs in reality. ...
5
votes
3answers
7k views

How to add unique id to file name in cron job?

My cronjob looks like this: 5 3 * * * mysqldump -u root test > /srv/backup/mysql_daily.dump How can I make filename unique for every time when cronjob writes mysql_daily.dump?
3
votes
1answer
3k views

cron not executing?

I have the following cron tab installed: crontab -l # m h dom mon dow command */10 * * * * "echo" >> /tmp/cron.log The server is at rackspace, it's a cloud server: Linux myserver #8 SMP ...
9
votes
1answer
10k views

Cron log on debian systems

On Redhat systems cron logs into /var/log/cron file. What is the equivalent of that file on Debian systems?
2
votes
1answer
2k views

Cron daemon error : Permission Denied

I am having trouble setting up a cron job. My set up is as follows: crontab -e */10 * * * * OTP_ProJect/PandaServerInfo/SVN/PandaQueueMonitoring/trunk/submit_cron_test.sh the shell script has ...
7
votes
3answers
13k 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?
1
vote
1answer
2k views

Cron: My crontabs don't seem to be doing anything at all

I think I'm missing something. I've set up some crontabs to handle rsyncs over ssh in my office to handle some backups, but they don't seem to be running OR logging, for that matter. Am I missing ...
4
votes
2answers
2k views

Configuring cron.hourly

I am unable to configure a cron job to run by placing it in /etc/cron.hourly folder. SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/ # run-parts 01 * * * * root run-parts ...
1
vote
3answers
523 views

Why does Crontab give me an error with my PHP script when running it from the terminal does not?

I'm having some problems with running the Crontab with PHP files. I have this same php scripts running in the Crontab for more than 6 months but some days ago mysteriously they stopped to execute the ...
2
votes
1answer
1k views

Are changes in crontab applied when the file is saved, or when the editor is closed?

When I do crontab -e, are the changes applied immediately when I save the file, or do I have to exit vim for it to be applied?
16
votes
6answers
38k views

Why did my crontab not trigger?

I used crontab -e to add the following line to my crontab: * * * * * echo hi >> /home/myusername/test Yet, I don't see that the test file is written to. Is this a permission problem, or is ...
2
votes
3answers
252 views

Crontab syntax: using '*' for minutes value

What happens if I use '*' for the minutes value? Is the command going to be run every minute? For example: * 4 * * 0 <command>
6
votes
2answers
6k views

Not able to ssh in to remote machine using shell script in Crontab

Below is the script which i am trying to run, which runs without any issue for i in `seq 200 2100` do usr=(`ssh -t -t -o ConnectTimeout=60 machine$1 finger | tail -1 | awk '{print$1}'`) echo ...
11
votes
5answers
23k views

Using the system date / time in a Cron Script

I'm setting up a Cronjob that will backup a MySQL database I have in my server, but I don't want it to keep overwriting the same file over and over again. Instead, I want to have an array of backups ...
8
votes
2answers
8k views

Bash Script on Startup? (Linux)

Is there any way to make/run a bash script on reboot (like in Debian/Ubuntu for instance, since thats what my 2 boxes at home have) Also, any recommended guides for doing cron jobs? I'm completely ...
15
votes
2answers
56k views

How can get a list of all scheduled cron jobs on my machine?

My sysadmin has set up a bunch of cron jobs on my machine. I'd like to know exactly what is scheduled for what time. How can I get that list?
3
votes
4answers
6k views

executing a sh script from the cron

I have a test.sh script #!/bin/sh php /home/v/file.php sh /root/x/some.sh when I execute the file as root from command line it works. sh /home/v/test.sh when I set it to crontab -e (is the root ...
1
vote
3answers
363 views

Cron with a 12-hour issue?

I have a cron job that's managed through plesk. I'm being told that it's being executed twice in a day, once at 5AM and once at 5PM, based on the email that's being received. Here's the cron line: ...
1
vote
2answers
838 views

using cron to run script

Hey guys, im trying to run a script using cron, im using a crontab created by the user ashtanga, in the crontab i have */5 * * * * /home/custom-django-projects/SiteMonitor/sender.py in top of the ...
3
votes
2answers
2k views

Add a one-off scheduled task through a shell script?

I'd like to execute a task at a given time, once. I know I can just use crontab -e to add it there, but I'd like to do that through a shellscript. crontab -e gives me some temporary file to edit ...
12
votes
3answers
12k views

Does RHEL execute all cronjob files under /etc/cron.d/*?

This is a RedHat Enterprise Linux 5 system (RHEL). We manage this system using Cfengine. We have several cronjobs which are running twice as often as usual. I checked the cronjobs under /etc/cron.d/ ...
2
votes
4answers
2k views

Anacron job complains “Gtk-WARNING **: cannot open display”

I'm trying to make a simple weekly Anacron job that backs up my computer if I click yes on the dialog. The script I wrote works fine if run manually, but when Anacron runs it, nothing happens and I ...
4
votes
1answer
81 views

When I schedule a command with 'at', can I change where the output is mailed to?

When I schedule a job/command with at to be executed in the future, the standard output and error of the command is "mailed" to the user that did the scheduling. So after my job runs, I get a message ...
7
votes
3answers
9k views

/etc/cron.daily/foo : Send email to a particular user instead of root?

I'm running CentOS 5.5. We have several cronjobs stored in /etc/cron.daily/ . We would like the email for some of these cronjobs to go to a particular email address, while the rest of the emails in ...
3
votes
2answers
419 views

I need help with a cronjob to watch for runaway processes and kill them

I have an interesting situation, I have a runaway ruby process - I know exactly how I trigger it. Point is, it got me thinking about runaway processes (CPU usage or memory usage). How would one ...
3
votes
1answer
3k views

How to have cron run a python script as root?

How can I get cron to run a python script as root? Here is my crontab file: 0 * * * * ./twitter/twitter.py Am I doing something wrong?
2
votes
1answer
184 views

Stop cron script from destroying my mirrorlist with invalid data

I have to following cron script that runs daily. As you should be able to see from the code, it outputs the results from reflector to /etc/pacman.d/mirrorlist. $ cat /etc/cron.daily/update-mirrorlist ...
3
votes
5answers
1k views

how to ensure a program is always running but without root access?

Currently I need to have a program running all the time, but when the server is rebooted I need to manually run the program. And sometimes I'm not available when that happens. I can't use a normal ...
2
votes
1answer
281 views

How does fcron knows whether the job was run?

I recently migrated from vixie-cron to fcron on my laptop. I have a question: how does fcron knows if a particular job was run in given period of time? As a file can change during running, what ...
9
votes
5answers
5k views

Run a script via cron every other week

I've done quite a bit of research in how to do this, and I see there's no direct way in cron to run a job, say, every other Thursday. Right now, I'm leaning toward making a script that will just run ...
2
votes
3answers
447 views

Weekly cron job to save list of installed packages

I am having trouble figuring out how to set up my first cron job. I simply want to run this command once every week: dpkg -l > ~/Dropbox/installed_packages My /etc/crontab file contains the line ...
34
votes
8answers
61k 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?