Questions tagged [cronjob]

89 questions
81
votes
4 answers

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' are users that have been created specifically…
morpheous
  • 4,263
  • 12
  • 32
  • 30
57
votes
2 answers

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
  • 12,445
  • 5
  • 27
  • 26
29
votes
2 answers

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
  • 2,133
  • 7
  • 37
  • 42
16
votes
2 answers

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
  • 196
  • 1
  • 9
11
votes
5 answers

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 the following line : TZ="Europe/Paris" Despite…
9
votes
3 answers

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 example, say it starts from 3:30 am — can we do this?…
Devaraj C
  • 191
  • 1
  • 1
  • 3
9
votes
3 answers

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, and only email on error (which I understand can be…
jrdioko
  • 12,445
  • 5
  • 27
  • 26
7
votes
2 answers

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 internet. The script is set to run via cron, executed…
Sune Rasmussen
  • 173
  • 1
  • 4
4
votes
3 answers

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
  • 41
  • 1
  • 2
4
votes
2 answers

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 apologize if I sound stupid!
Christopher
  • 141
  • 1
  • 1
  • 4
3
votes
1 answer

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 hour. Prehaps some one could clarify the…
nelaaro
  • 13,149
  • 30
  • 84
  • 111
3
votes
2 answers

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 *.rss me@myserver.com:/home/dir --password-file…
Richard
  • 955
  • 5
  • 13
  • 16
3
votes
1 answer

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 command correct to do this for one…
Glen
  • 33
  • 2
3
votes
2 answers

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 time, when it is supposed to run, but my machine…
Christian
  • 567
  • 1
  • 4
  • 5
3
votes
3 answers

Running a cron job every other Monday

I want to run a job using crontab every other Monday. Is it possible?
Deepank Gupta
1
2 3 4 5 6