Questions tagged [cronjob]

90 questions
83
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,463
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
  • 13,195
31
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,585
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
  • 346
  • 1
  • 3
  • 12
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…
10
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
  • 201
10
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
  • 13,195
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…
4
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
  • 1,015
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
4
votes
2 answers

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 en0 down > /dev/null 0 7 * * * root ifconfig en0 up >…
user242065
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!
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
  • 14,139
  • 30
  • 88
  • 115
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
  • 587
1
2 3 4 5 6