Questions tagged [cron]

cron is a task scheduler based on clock time that runs on Linux-based machines.

Filter by
Sorted by
Tagged with
80 votes
11 answers
141k views

How can I get a script to run every day on Mac OS X?

Cron? Launchd? iCal?? If so, how?
Paul D. Waite's user avatar
46 votes
4 answers
43k views

Log of cron actions on OS X

Does the cron which comes with OS X log its actions anywhere? I'm not looking for output of any particular cron job, but rather log of what cron is doing. On a couple linux machines I've checked, ...
Doug Harris's user avatar
  • 27.8k
84 votes
13 answers
195k views

How to make WSL run services at startup

After searching this site and various Q, it is clear that services and systemd is not available for WSL. I need to run a program in WSL every time I start my PC so I read this page on how to use ...
seanbw's user avatar
  • 983
35 votes
5 answers
64k views

How do I run a launchd command as root

I have the following launchctl command as a .plist file. It's loaded and set to run once a day but, it needs to run as root and I'm not sure how to verify this. Also, this cron job basically CDs ...
Emmanuel Mwangi's user avatar
17 votes
1 answer
13k views

crontab day of week vs. day of month?

I added this to /etc/crontab on a few different linux & freebsd systems: # monthly reboot: 3rd Tuesday of every month 56 07 15-21 * 2 root /sbin/shutdown -r now I want a reboot on the 3rd ...
ane's user avatar
  • 173
4 votes
2 answers
3k views

rsync over SSH with cron in osx-environment

I want to automatically download files and folders from a Linux server to which I have an SSH (and FTP) account. The files shall be downloaded on a regular basis (I suppose a cron is the right tool to ...
Martin's user avatar
  • 143
3 votes
7 answers
12k views

Automatically restart a Unix job if it goes down?

I have a job that I would like to "daemonize" on Unix: I want it to come up when the computer boots, and I want it to restart if it goes down. A simple way to do this is to setup a cronjob that runs ...
Joseph Turian's user avatar
101 votes
8 answers
184k views

How can I view results of my cron jobs?

I see so many guides on how to run crontab, but what I need right now is to learn how to Find log files about cron jobs Configure what gets logged
Zombies's user avatar
  • 3,812
72 votes
2 answers
124k views

Set a cron every certain hours between certain hours

How can I set a cron to run every 2 hours between 8 am and 5 pm for example? Is this possible?
luqita's user avatar
  • 841
15 votes
2 answers
34k views

Behavior of rsync with file that's still being written?

If Apache is in the middle of writing a large file and an rsync cron job runs on that file, does rsync attempt to copy the file? Example Apache-1: Has file large being written to /var/www. Apache-2: ...
Louis Waweru's user avatar
  • 24.6k
12 votes
2 answers
6k views

Common Mac OS folders/settings to check (when trying to get rid of a pesky self-launching app)

If there's an app that starts up by itself, what would the most efficient places to look for it be? Does anyone have a nice comprehensive list of where to check for Startup Items, Login Items, Login ...
username's user avatar
  • 1,398
5 votes
3 answers
14k views

Open a terminal from a Crontab

How do I get a gnome-terminal window to open from a crontab? I have tried this: * * * * * /usr/bin/gnome-terminal * * * * * source /home/user_name/.bashrc ; /usr/bin/gnome-terminal * *...
userend's user avatar
  • 165
3 votes
2 answers
18k views

crontab - /bin/sh: wget: command not found

I want to set up a crontab on my Macbook Pro running Lion. I run the usual crontab -e and provide a quick job to see if everything is working ok --- */10 * * * * wget -O - -q -t 1 http://site.local/...
Allan Thomas's user avatar
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
1 answer
573 views

Anacron running daily tasks hourly instead of daily

I have Anacron set up to run a backup daily, weekly and monthly. The monthly seems okay, but the daily and the weekly are running roughly every half hour every day! Here is my /etc/anacrontab # /etc/...
Peter White's user avatar
0 votes
1 answer
99 views

Shell script zips a folder, but exclude parameters not working IF its run from cron.daily

The script works fine if I run it with sh filename, but it ignores all the --exclude parameters if its run by cron: #!/bin/sh TIMESTAMP=$(date +%u) WEEK=`date +"%V"` if [ $(($WEEK%2)) -eq 0 ]; then ...
Viktor Koncsek's user avatar
59 votes
19 answers
129k views

Run a cron job on the first Monday of every month?

I'd like to run a job from cron at 8.30 on the first Monday of every month. The cron Wikipedia page says While normally the job is executed when the time/date specification fields all match ...
Max Williams's user avatar
  • 2,989
40 votes
3 answers
1k views

What is the point of system-autodeath?

In a previous question I found a "system autodeath cron job" which would shut down my default network route daily. As I have never heard of such a thing before, I would like to know what it exactly ...
bobby's user avatar
  • 553
36 votes
2 answers
53k views

Why doesn't my cron.d per minute job run?

I have thrown a bunch of darts trying to get a python script of mine to execute every minute. So I thought I'd simplify it to just do the "simplest thing that could could possibly work" once per ...
Travis Griggs's user avatar
33 votes
5 answers
43k views

crontab to wake osx from sleep

I have a crontab which will launch a certain program early in the morning (after I have gone to sleep) and close it again later in the morning (before I wake up). But my iMac will not execute the ...
Nippysaurus's user avatar
  • 1,435
24 votes
3 answers
46k views

How to use @reboot in /etc/cron.d

I am migrating individual user's crontabs to /etc/cron.d, as that would allow proper backup, restore and versioning. So far, as I understand the only difference between user's crontabs and the etc ...
hyperknot's user avatar
  • 892
21 votes
2 answers
67k views

linux: how to run a command in a given directory

I simply want to just run a command (actually its a shell script) from a given directory as a cron job. How can I run it so that it is set to a given directory without using cd.
Zombies's user avatar
  • 3,812
20 votes
2 answers
27k views

Run a cron job every 5 minutes between two times

Is there a way to specify a job that runs every 5 minutes between some start time and some end time on business days in a crontab? Update I think it's relevant that my start and end times are not at ...
pythonic metaphor's user avatar
15 votes
1 answer
56k views

Why is my crontab not running

I have this cron 38 * * * * /bin/bash -l -c 'cd /var/rails/site/releases/20120705144335 && script/rails runner -e qa '\''Play.load_lists'\''' I have this cron under the a different user so ...
Matt Elhotiby's user avatar
14 votes
2 answers
13k views

How do I create a cron job that will commit my project changes to git on a weekly basis

I'm using git for the purposes of making a historical transcript of the changes made to my project. I understand it's not the ideal usage but it's the usage pattern I've chosen for various reasons ...
Jason's user avatar
  • 1,899
12 votes
4 answers
18k views

How to set cron PATH globally (i.e. for all users) permanently?

We need to have /usr/local/bin in cron's path for all users. Is there a way to set it system-wide, without needing to edit each individual user's crontab? We've tried adding PATH to /etc/crontab: # ...
grosser's user avatar
  • 393
12 votes
7 answers
35k views

cron: run a process but only if it isnt running?

Is there a way for me to tell cron to run an app BUT not run it if a process exist already?
user avatar
11 votes
2 answers
15k views

How do you use the run-parts command?

For some reason my crontab is not running the hourly/weekly/etc scripts. It seems to be that run-parts is not working and I cant get it to work on my local machine as well. Is there a mistake in the ...
Fabian Barkhau's user avatar
11 votes
8 answers
52k views

Bad minute in crontab?

I get the following error in my syslog: Oct 17 13:14:03 tracker cron[873]: (*system*) ERROR (Syntax error, this crontab file will be ignored) Oct 17 13:14:03 tracker cron[873]: Error: bad minute; ...
David Pfeffer's user avatar
10 votes
4 answers
25k views

how to run cron jobs on GMT not local time?

How can I make cron jobs run on GMT, not local time? this is my crontab file: #m h d m wday command TZ=GMT 5 0,6,12,18 * * * ~/Documents/bash/transfer.sh my jobs seem to ...
compound eye's user avatar
8 votes
1 answer
26k views

cron apparently requires a newline character on its own line at the end of the file

I'm trying to understand why cron is refusing to work with a certain crontab file. The manpage for crontab says: cron requires that each entry in a crontab end in a newline character. If the ...
lps's user avatar
  • 266
7 votes
4 answers
8k views

cron runs but nothing happens

I have created a script called "forward_email.sh" and set permissions to 777. It contains the following line: echo "It worked: $(date)" >> /home/noc/email.log I created a cron job with the ...
Joseph's user avatar
  • 2,219
7 votes
9 answers
3k views

How can I write a cron job that will block my internet from 7pm to 7am? (So I can get some sleep)

I am using OSX 10.6 and it has cron built in. How can I write a cron job that will block my internet from 7pm to 7am every day? Im sure this must be simple but I could only find one example online ...
user avatar
5 votes
3 answers
11k views

How do I automate borg backup?

Background I would like to use Borg Backup as a backup solution for my Ubuntu server. They offer a very convenient sh script that they say you can just run as a cron job, but it is not working for ...
sgbrown's user avatar
  • 221
5 votes
4 answers
4k views

with a shell script, it is possible to tell when it's run with cron vs run manually?

with a shell script, it is possible to tell when it's run with cron vs run manually? UPDATE: it was asked why I want to know. My cron job will be logging, and i want to be able to log if someone ...
Roy Rico's user avatar
  • 5,918
5 votes
3 answers
11k views

How to run a script at boot time for normal user?

I want to run a bash script at boot time in CentOS 6. I added the script in /etc/init.d/ directory but all these script are run by root. I want to run script for any user.
Waqas Rana's user avatar
5 votes
2 answers
11k views

Linux startup script to connect to bluetooth and cron to keep it connected

I have a mini Bluetooth keyboard and a Raspberry Pi running a Debian-based distro. I know the MAC address of the keyboard but for this question, let’s just use AA:BB:CC:DD:EE:FF. Right now I have to ...
D.R.'s user avatar
  • 123
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
3 votes
1 answer
405 views

certbot-auto fails to install automatic renewal?

I am using kernel 3.10 on CentOS 7. I have successfully installed CertBot 1.10.1 using alternative installation instructions as certbot-auto. Running certbot-auto successfully generated certificates ...
Alex's user avatar
  • 192
3 votes
3 answers
11k views

Why does this script fail when run from cron, but works when run manually?

I have a relatively simple bash script that works great when invoked directly, but fails when run by cron. Why does this fail and how can I make it work via cron? #!/bin/bash apt-get update -y apt-...
JVC's user avatar
  • 412
2 votes
2 answers
9k views

How to properly use environment variables in crontab

I export a variable in my ~/.bashrc file (Ubuntu 20), which I'd like to use in a cron job. Searching for answers, I found two ways of doing it, but none worked for me: 12 11 * * * BASH_ENV=/home/l86/....
Leandro 86's user avatar
2 votes
0 answers
113 views

why does this anacron job run hourly, not daily? [duplicate]

I'm running zulip on a virtual private server, and have created a script backup-zulip on my laptop (with ubuntu 20.04) to back up zulip via ssh. I want to run this script daily, so I put the line @...
user313032's user avatar
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
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
1 vote
1 answer
11k views

Python script not running as cronjob

I have tried everything and I've seen other questions here regarding this but I cannot for the life of me run a python script as a cronjob. I've tried the following. * * * * * /usr/bin/python /home/...
KingKongFrog's user avatar
1 vote
1 answer
1k views

Cron scheduled backup script not working or writing to log file

I have a duplicity backup script set to run once per day through the root cron tab. I set it up like this: sudo crontab -e -u root and added the line: 00 03 * * * root /home/[myusername]/...
dysonsphere's user avatar
1 vote
3 answers
8k views

Starting script in screen with cron

I apologise if this has been asked before but I am not sure how to question a search query for this. I am extremely new to linux and I have been learning as I go to solve issues. I am trying to set ...
TheAngryBr1t's user avatar
1 vote
2 answers
685 views

Running shell Script via Crontab

So I've tried to run a shell script via crontab. My Crontabs look like this: 00 20 * * * $HOME/Bilder/Hintergründe/.background_skript/background_night.sh and my background_day.sh looks like this: `#!/...
Sebastian Illi's user avatar
0 votes
1 answer
375 views

Cron strange behaviour

I've got a Bash script with all the permission to be excecuted, I attach it to to a cron job, this script basically only kills and restarts a specific process. The strange behaviour is that if I run ...
FabioEnne's user avatar
  • 133
0 votes
1 answer
11k views

How to set cron expression to run first Weekday (MON-FRI) and first Weekend (SAT-SUN) of the month?

I tried for the Weekend (SAT-SUN) cron expression: 0 0 18 ? 1/1 SAT#1,SUN#1 * but it didn't work.
Vitthal Muguli's user avatar