Questions tagged [cronjob]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
81 votes
4 answers
219k views

How to run a cron job as a specific user?

I would like to run a cron job as a specific user on my machine. How may I specify the user for a cron job to run as?. The cron jobs will be running on a server (running on Ubuntu 10.0.4). The 'users'...
morpheous's user avatar
  • 4,333
57 votes
2 answers
62k views

Difference between /etc/crontab and "crontab -e"

What is the difference between the crontab located in /etc/crontab and the crontab that can be edited using crontab -e?
jrdioko's user avatar
  • 12.8k
29 votes
2 answers
24k views

Where to store cronjob script?

I'd prefer to not keep it in my /home/myusername directory. Is there a best practice of where to store your shell scripts for cronjobs? At the root level? I'm running ubuntu server 12.04 right now.
tarabyte's user avatar
  • 2,323
16 votes
2 answers
6k views

Can I specify a specific time with seconds with Linux crontab?

49 18 * * * mpv ~/Musik/Donau.mp3 This command would play the Donau.mp3 file at exactly 6:49pm. How could I, for example, specify 6:49:50pm?
Peter Andres's user avatar
11 votes
5 answers
30k views

Timezone issue with cron

My cron jobs are computed one hour later compared to server time. I don't understand what is going on. My configuration is the following : Server time : Europe/Paris In /etc/default/cron I added ...
Guillaume Lebourgeois's user avatar
10 votes
3 answers
55k views

cron expression for every hour starting from specific time

Every one hour (starting from "now") I am able to schedule using this cron expression (expression) using nodejs cron-job. But I need to set cron every one hour starting from a specific time. For ...
Devaraj C's user avatar
  • 201
9 votes
3 answers
8k views

Only email on cron errors for jobs in cron.daily, cron.hourly, etc

I have several cron jobs that run (in /etc/cron.daily, /etc/cron.hourly, /etc/cron.weekly, etc.) and email root@localhost with the results. I'd like to stop those emails if the jobs are succeeding, ...
jrdioko's user avatar
  • 12.8k
7 votes
2 answers
4k views

Can Ubuntu play a video via cron job?

I'm developing a display system for a paint shop. I've set up a computer with Ubuntu to run the video and display it on a TV, running a PHP script that should update the video every hour via the ...
Sune Rasmussen's user avatar
4 votes
2 answers
43k views

How to create a cron job to upload files to an FTP server

I would like to create a cron job that uploads files from a directory on my computer to my FTP server. I would like it to do it daily at midnight. I know pretty much nothing about cron, so I ...
Christopher's user avatar
4 votes
2 answers
69k views

rsync cron job with a password?

I want to set up an rsync command as a cron job, so I need to find a way to supply my server password automatically to rsync. Currently I have a shell script that looks like this: #!/bin/sh rsync *....
Richard's user avatar
  • 995
4 votes
3 answers
5k views

Stop Cron job for a particular time interval

I have a cron job which runs every five minutes all day long. I want to stop this cron job running on Sundays between 4pm and 5pm - it should start again after this time. How can I script this?
akd's user avatar
  • 41
3 votes
1 answer
2k views

crontabs hour specification */1 is that the same as *

I am looking for clarification with the cron tab that I am working with. some job 1 * * * * some job 1 */1 * * * Are those jobs the same? The job will run the first minute every ...
nelaaro's user avatar
  • 13.6k
3 votes
2 answers
644 views

Execute a cronjob once a day, when machine is on, but not necessarily at a specific time

I want to run a cronjob once every day on a machine that doesn't run all the time, but runs at least once a day for a couple of hours. The problem with a cronjob is, that I have to give it the exact ...
Christian's user avatar
  • 577
3 votes
2 answers
6k views

Help with running crontab from root

I'm using Mac OS X and having trouble getting a cron job to run. I type the following: $ sudo -i $ crontab -e I then enter: * * * * * root ifconfig en0 down > /dev/null 0 19 * * * root ifconfig ...
user avatar
3 votes
3 answers
2k views

Running a cron job every other Monday

I want to run a job using crontab every other Monday. Is it possible?
user avatar
3 votes
1 answer
291 views

Script to execute via cronjob that deletes all files in multiple directories

I'm hoping you can lend me your expertise. I use shared hosting on Hostgator and need to figure out how to delete all .gz files in multiple directories every hour. I think I have the cronjob ...
Glen's user avatar
  • 33
2 votes
3 answers
9k views

Why does this crontab file only run once?

I have the following crontab file: 2 * * * * /bin/date >> /home/jon/date_from_cron.txt I think this means "run every two minutes". However, it only runs once. Shortly after setting up this ...
tadasajon's user avatar
  • 317
2 votes
2 answers
3k views

Why is this cronjob not working?

I have a ruby script in ~/custom_scripts/get_all_products.rb. I want it to run every night at 04:00. Here's what the cronjob in crontab -e looks like: MAILTO="<email>" 0 4 * * * ruby ~/...
narzero's user avatar
  • 419
2 votes
1 answer
7k views

Cronjob for first day of month except sunday

I have such entry in my crontab: 0 0 1-2 * 1-6 It is correct that it would run at 00:00, 1st or 2nd day of the month from Monday to saturday? For example, if 1st day will be sunday then it would not ...
Alexander Kim's user avatar
2 votes
1 answer
3k views

How to test cron @reboot entry?

How can I test if @reboot is working without the need of reboot the machine? Is there anyway to force @reboot to entry to run? Thank you.
Augusto Will's user avatar
2 votes
1 answer
967 views

I created Cron but I get errors that don't really understand

I created a crontab like this: 0 22 * * 2 /bin/echo " Hello World " 0 1 * * * /bin/echo " Test" but I receive mails like this, what does it mean? Subject: Cron /bin/echo " Test" Content-Type:...
user229366's user avatar
2 votes
2 answers
5k views

Run Cron every 2 minutes in 30 minutes?

I need to run a cron job every 2 minutes (*/2) but only for the first 30 minutes of every hour, with pause of 30 minutes between the runs. For example, something like: From 10h00 to 10h30: run every ...
Hugo ferreira's user avatar
2 votes
1 answer
3k views

Where to store security credentials (aka passwords) for special cron jobs?

I want to write a cron job that authenticates for a certain mail account. As there are multiple ways in giving the script those credentails: config file, hardcoded in script, arguments in cronjob call,...
math's user avatar
  • 2,653
2 votes
1 answer
489 views

Schedule a cronjob everytime it is done

I have a cronjon which runs every 48 hours. But ideally what I want is that it must start running as soon as it stops. Can this be done? It is an sh script consisting of a python command. I am using ...
Rishi's user avatar
  • 123
2 votes
2 answers
5k views

How to set CRON to execute a php file outside of a public html folder?

I have a php file located at, let's say, for example: /data/web/process.php This file is not publicly available (no virtual host is running in that folder, but apache is installed). I need to ...
Frantisek's user avatar
  • 1,926
2 votes
1 answer
23 views

Trying to run a shellscript but not workung

My shell script is running when I manually run it. Cronjob is also working, al others are running but not this script. This is my code. 30 3 * * * cd /var/www/html/cronjob && sh shellscript.sh ...
Shibin Mariyan Stanly's user avatar
2 votes
3 answers
9k views

Cron Command for twice a month on Sat @12am

I am wondering if someone can help with the simple but sometimes confusing commands regarding Cron jobs. I would like a cron job to run twice a month on a Saturdat @12am.
gdsnytech's user avatar
1 vote
3 answers
1k views

Cronjob as root?

I'm having a bit of a problem with cronjobs for backups. I've set up the following in sudo crontab -e (not under personal account): 0 1 * * * /backups/dobackup /backups/dobackup contains this: #!/...
Rob's user avatar
  • 113
1 vote
5 answers
296 views

Cronjob not working

I've got a simple crontab for ripping my local radio station only when I want: 0 16 * * 0 /root/streamripper.sh 0 17 * * 0 killall streamripper 0 20 * * 0 /root/streamripper.sh 0 21 * * 0 killall ...
user avatar
1 vote
1 answer
192 views

Why this cronjob wont run

On debian squeeze as user root I add this cronjob with "crontab -e" */1 * * * * root /usr/sbin/ntpdate ptbtime1.ptb.de >> /var/log/ntpdate.log But this cronjob will not run, there is also ...
kockiren's user avatar
  • 462
1 vote
2 answers
1k views

Why cron saves at /root, when should at /var/www?

Why my cron */1 * * * * /usr/bin/php /var/www/query/query.php &> /root/querylog.log saves query.php output in the /root/ folder? (this script shall save *.txt at its location) It should do so ...
Szymon Toda's user avatar
  • 1,639
1 vote
2 answers
5k views

Cron daemon running status check

I have a script which need to be run as cron job. In the staging environment i could run the script as a cronjob. but in the production environment it is not working, so i checked whether cron ...
KItis's user avatar
  • 133
1 vote
2 answers
3k views

How do I make cron run a Java GUI application?

I have a script which runs a Java GUI application using "java -jar app.jar". I have added the script to the crontab to run every minute, check the processlist if the application is up. If it isn't it ...
nanoman's user avatar
  • 111
1 vote
2 answers
1k views

How to automatically restart crond if it is not running?

I use cron job to monitor and restart other services if they are not running. But how to monitor/restart crond itself?
peter's user avatar
  • 393
1 vote
1 answer
844 views

scheduling with cronjob to run the php file for only one time

How do I run the php file only once using the cron jobs. i.e., to schedule task to work on 20/06/2015 10:30:00 I tried something like this : 30 10 20 6 ? 2015 /usr/bin/php /path/to/my/file/...
Ahalya Hegde's user avatar
1 vote
2 answers
285 views

cron job not executing the binary in the time specified

I would like to check which is the environment being used if executing a cron job. I had it working before however it stopped at some point. This is my cron job in the crontab file: 20 13 * * * /usr/...
birdman's user avatar
  • 111
1 vote
1 answer
61 views

Trigger a command upon every `crontab -e` edit

We are using a shared Linux server account where as everyone comes and edits the crontab. Usually we take a backup like this crontab -l > `date +\%Y-\%m-\%d\_\%H:\%M:\%S.txt` Is there an elegant ...
nehem's user avatar
  • 369
1 vote
1 answer
2k views

Running a cron job every five minutes

I need to run a cron for sync command. Is it as simple as this? */5 * * * * --sync Which I think will run the sync command every 5 minutes.
tumble's user avatar
  • 21
1 vote
2 answers
453 views

Cron Job command - understanding

I am using a cron job, received from one of my suppliers, in order to create/update the products data, stock, status, in my Woocommerce website. I have installed their plugin, all verification are ...
Alin H's user avatar
  • 11
1 vote
0 answers
144 views

Lynx-dump cron job not working after installing SSL certificate

I have a cron job that has always worked fine, until we installed an SSL certicate and updated our .htaccess file to redirect all http requests to https. Now, the cron job is not working and I'm ...
Claire K's user avatar
1 vote
1 answer
694 views

How would I make a cron job stop and start again?

I am trying to make a cron job that stops at 12am today(friday) then start again Monday at 7am, what would the script for this look like, I am new to cron jobs.
MrPigbot's user avatar
1 vote
0 answers
367 views

Task Scheduler don't start Task every hour (Windows 10)

I configured a powershell script to grab some reddit rss feed. So I set the task to run every hour once to grab new feed items. But I can only run/trigger it manually. It won't start at every even ...
Georodin's user avatar
  • 167
1 vote
0 answers
1k views

McAfee Endpoint Security for Linux Threat Prevention cannot schedule ODS-Tasks [closed]

McAfee Endpoint Security for Linux Threat Prevention, Version : 10.5.4.106 We are working on a Linux server with a pre-installed McAfee. The regular ODS-Scanning has been really annoyed us. So we've ...
xulin tan's user avatar
1 vote
0 answers
92 views

Rebooting a Linux server with best practices. Should I save what?

I would like to know what steps should I take before rebooting a Linux server to avoid losing the configuration. Example: I made a rule with iptables manually, did not add to rc.local. This won't ...
Marlon's user avatar
  • 359
1 vote
1 answer
926 views

Many cron -f processes on unresponsive server

My Debian server had again become unresponsive and needed to be restartet (SSH login impossible, no longer transmitted log data to another server's MySQL Database, no new FTP connections possible, but ...
azren's user avatar
  • 111
1 vote
0 answers
224 views

Mac Crontab Deleted

I was messing around with creating cron jobs and somehow I wound up deleting crontab out of /usr/bin. Does anyone know of a way that I can recover it without having to re-install multiple components ...
user202029's user avatar
1 vote
0 answers
1k views

CronJob for asterisk queue to reset + FreePBX

I am having problems with this script...It doesn't seem to work. Note: It sends email just fine. #!/bin/bash #Reset the queue every morning at 5:00AM PST #v 1.1 changed email #Email alert that ...
JoyIan Yee-Hernandez's user avatar
1 vote
1 answer
1k views

What might cause cron jobs to occasionally not run or complete?

In my crontab, I have set MAILTO and a bunch of cron jobs (5-10 jobs). These cron jobs usually run fine and I get emails for them. Most of these jobs consistently run as expected. Emails and ...
Syncopated's user avatar
1 vote
0 answers
2k views

Why does cron task run twice?

I have a task that should run each day in Ubuntu10.04. So I use crontab and copy the scripts of the task to the directory /etc/cron.daily. Here is the my crontab: # /etc/crontab: system-wide crontab ...
flypen's user avatar
  • 307
1 vote
1 answer
2k views

Enabling crontab logging on openSUSE

I am trying to enable the crontab log on openSUSE 11.3. I searched the web but couldn't find how to do it. I only find information about Ubuntu. Tried editing the /etc/rsyslog.d/remote.conf file but I ...
RegedUser00x's user avatar