Questions tagged [cron]

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

Filter by
Sorted by
Tagged with
9 votes
2 answers
7k views

cron can't read PYTHONPATH environment variables?

I have added to the PYTHONPATH on my server's .bash_profile file. However it appears that cron isn't reading from it because I am getting import errors. If I run the exact command cron calls on the ...
JiminyCricket's user avatar
9 votes
2 answers
7k views

Which bash rc files are run on non-interactive/non-login shells?

My Understanding there are no rc files called for non-interactive/non-login shells; for example, those run by cron (I don't know this for certain and would lean on the community's expertise) non-...
vol7ron's user avatar
  • 485
8 votes
4 answers
19k views

how do i run a script 5mn after startup?

I have severals RoR websites running on my webserver and I need to run a ruby script at startup. So, I puted a bash script in /etc/init.d witch call a ruby process. Unfortunatly that ruby process ...
boby lapointe's user avatar
8 votes
2 answers
21k views

BASH - merge directories when using mv

I just started using BASH, so I can move all contents of a directory to another. But the issue is, I was expecting it to merge the directories. I am using cron job to run this script. #!/bin/bash ...
The Bash's user avatar
8 votes
5 answers
29k views

Disable cron jobs for a specific user

I have a list of jobs in the crontabs for user1, user2. I want to prevent the jobs of user2 from running. I tried listing user2 in cron.deny, but that only prevents him from accessing his crontab. ...
NOLFXceptMe's user avatar
  • 1,232
8 votes
4 answers
4k views

Use cron to screen capture on Mac OS X

To analyze my own computer usage, not to spy on anyone (although it crossed my mind), I want to have cron capture the current screen every minute. * * * * * /bin/bash -c "/usr/sbin/screencapture /...
physicsmichael's user avatar
8 votes
1 answer
4k views

git push to github via cron on mac

I'm trying to use git push in a bash script being run by crontab to push a commit to github. At the end of the script I'm doing this: # script processes some files, then: git add -A git commit -a -m "...
Stephen Turner'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
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
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
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
7 votes
1 answer
5k views

Ubuntu: how does cron execute jobs?

I am having trouble finding an answer to this question thorough google: How exatly does CRON in ubuntu execute jobs? Does it spawn each new job in its own process? Say i have two cron jobs: @...
Martin Nielsen's user avatar
7 votes
2 answers
1k views

Having all systemd timers mail to root on error

cron sends an email to the crontab owner on job error. How can i have systemd do the same when it runs a timer? Note: I am not looking for a recipe for adding email notification to a specific service. ...
Francesco Potortì's user avatar
6 votes
4 answers
23k views

How can I permanently fix my date synchronize problem in linux?

Ubuntu 7.10 server i386 clock/date/time won't stay in sync. Are their log files I can view to tell when the clock changes? For a temporary fix, I created a file in /etc/cron.hourly: #!/bin/sh ntpdate ...
David Fox's user avatar
  • 479
6 votes
1 answer
39k views

How to use @reboot for crontab with delay

In crontab, I can use @reboot to run a command after the system reboot. Is there a way to do this with an delay, i.e. run a command after 10 minutes of reboot?
ltfishie's user avatar
  • 195
6 votes
4 answers
15k views

How to run webcam software only when I am not home (phone is not on the LAN)?

Currently I've got my user cron starting Motion on a timer when I typically leave for work, and then killing it when I typically get home, so I can watch my cat/burglars/etc: 0 9 * * * killall motion ...
endolith's user avatar
  • 7,607
6 votes
1 answer
29k views

How to mail output of shell script as a cron job

I've created a cron job that runs a shell script. I'd like the shell script to run and capture it's output and have it emailed upon completion. Here's what I have so far, but the mail message body ...
Nilpo's user avatar
  • 227
6 votes
2 answers
17k views

Why does root cron job script need 'sudo' to run properly?

I'm running this simple script on my Raspberry Pi to auto update so I can forget about it. It also keeps a log that says whether the update was successful. The script is update.sh: #!/bin/bash echo "...
freejuices's user avatar
6 votes
1 answer
6k views

cron.weekly and cron.monthly run times

What day of the week does cron.weekly run on What day of the month does cron.monthly run on?
Tyler's user avatar
  • 175
6 votes
2 answers
4k views

How to use variables in variables in crontab

I'm trying to use variables in variables in crontab: AUTH=user:password BASE_URL=http://... COMMAND_OLDB=curl -u $AUTH $BASE_URL/openligadb >> /var/log/cron.openligadb.log But just getting a ...
dtrunk's user avatar
  • 163
6 votes
1 answer
2k views

Why does running Redshift commands from crontab does not seem to work?

About redshift: Redshift adjusts the color temperature of your screen according to your surroundings. A typical redshift command that I use is redshift -O 9999 which sets the screen color ...
ToonAlfrink's user avatar
6 votes
3 answers
4k views

From what context is a cron task executed?

I am asking this question after royally destroying a Linux box. Let me give you some background so you know where I am coming from. I currently have (well... did have) a RedHat Linux box running ...
John's user avatar
  • 294
6 votes
1 answer
12k views

Nice commands in a .sh script for cron jobs

I have a php script that I need to run on shared webhosting. I have created a cron job that executes an sh script. The command in my crontab is: /bin/sh /home/user/script.sh I'm assuming it is Bourne ...
xlordvader's user avatar
6 votes
2 answers
7k views

cron job when Ubuntu is suspended

I am using Ubuntu precise. Is there a way to have scheduled cron jobs run even when Ubuntu is suspended? Perhaps some way to automatically wake up the system so a scheduled cron job can proceed and ...
MarcusJuniusBrutus's user avatar
6 votes
1 answer
14k views

How to handle daylight savings in cron jobs

I have a cron job on an amazon ec2 machine (Ubuntu 16.04) that is supposed to run at 2:00 AM Central time. The cron job is scheduled using UTC time. Since Central time is currently UTC-5 (we are in ...
user1334007's user avatar
6 votes
2 answers
847 views

Anacron, execute job as many times as it has been missed

If I schedule a job to be run at 3 A.M. every day and it is missed 3 days in a row, will Anacron execute it 3 times when the system comes back running, or only once ? If it is only run once, is there ...
pHeoz's user avatar
  • 237
6 votes
1 answer
5k views

Is there a aliases file for sSMTP?

I installed sSMTP for sending emails from command line. I want to create some alias for cron jobs: $ sudo vim /etc/aliases # append this line at the end myname: root $ newaliases newaliases:...
kev's user avatar
  • 12.8k
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,928
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
2 answers
2k views

Why doesn't cronjob execute feh command

I build a cronjob to download a new picture from a source every ten minutes and set it as wallpaper using feh. The file is downloaded but the wallpaper doesn't change. Where is the problem? crontab -e ...
globus243's user avatar
  • 216
5 votes
2 answers
3k views

Delete all files older than X days

So I have a cron setup to make backups of a folder into a tarball every hour. I would like to add into the shell script that I'm using the ability to have files deleted automagically after about three ...
Chiggins's user avatar
  • 399
5 votes
3 answers
2k views

Run Linux script at time 'n' on first day, 'n+15 mins' next day, and so on

I'm trying to take timelapse images using my webcam. What I want to do is run a script at midnight on 1st Jan, then 00:15 on 2nd Jan, 00:30, 3rd Jan and so on. This can keep running forever, I'll ...
Piku's user avatar
  • 597
5 votes
4 answers
22k views

How can I add a timestamp to the end of a cron job's output file name?

I want to track each crontab output to separated file. Normally, I use this as crontab entry: 1 * * * * root php /mix/dostuff.php > /tmp/dostuff.txt Now, I want to make it to write ...
ariefbayu's user avatar
  • 1,173
5 votes
1 answer
16k views

crontab job log message shows a error status 0x004b from mta#012

The crontab job log message shows a error status 0x004b from mta#012 when I try to check my crontab job. # grep CRON /var/log/syslog [...] I get this log: Nov 26 08:00:01 stiitsrv9 CRON[26109]: (...
Be2's user avatar
  • 55
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
5k views

using either notify-send or zenity in Cron

I am trying to get cron to provide a screen alert when it spots a particular situation. I know the script is executed each minute but it will not display on the screen. script executed is: DISPLAY=:...
user avatar
5 votes
10 answers
39k views

How can I automatically take a screenshot of a website at a specified time? [closed]

I need to take a screenshot of a website automatically at a time specified by me. Ideally it would not be using my computer since it's not guaranteed to be on at the specified time. Is there some ...
SBSTN's user avatar
  • 361
5 votes
2 answers
4k views

Will cron.daily wait for jobs to finish before starting the next one?

This page http://wiki.ci.uchicago.edu/I2U2/WebalizerConfiguration suggests renaming /etc/cron.daily/logrotate so it comes after /etc/cron.daily/webalizer - webalizer should be done before logrotate ...
commonpike's user avatar
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
5 votes
1 answer
3k views

Can't use /usr/bin/security to retrieve password from keychain via cron

I can't seem to be able to successfully retrieve passwords from keychain using /usr/bin/security when I run it from my users crontab. Works fine in my terminal. I can also see via the cron mail ...
rxvt's user avatar
  • 111
5 votes
2 answers
6k views

Cron ignoring an update to crontab

I've commented out a line in the crontab on a debian server, which I guess was there by default yet was causing me to get error emails every hour: # m h dom mon dow user command 17 * * * * root ...
GJ.'s user avatar
  • 9,853
5 votes
1 answer
1k views

mount and umount behaving differently when run under cron

Running CentOS 6 in AWS, and what I'm seeing is baffling me. There is an s3fs mount in /etc/fstab that sometimes loses its ability to read and write from. I have a cron job that worked great for ...
Joshua Grigonis's user avatar
5 votes
2 answers
40k views

how do I see the history of crontab?

I've read a few posts on the web, gone and looked for the file they are mentioning and haven't found it. I'm in Ubuntu 11 and trying to troubleshoot a cron job that isn't running, even though I have ...
jcollum's user avatar
  • 5,163
5 votes
2 answers
6k views

Should I worry about Daylight saving time when planning to schedule backups?

So if there is a day: https://secure.wikimedia.org/wikipedia/en/wiki/Daylight_saving_time when we have to e.g.: set our clock back from 3am to 2am. Ok. So if someone creates a cron job at 3am, ...
LanceBaynes's user avatar
  • 4,090
5 votes
4 answers
9k views

rm failing inside cron script

I have a cron job calling a bash script which runs fine, except for one line inside it that is suppose to remove all fines in a directory. The result of this line is always 'no such file or directory' ...
Nicholas's user avatar
  • 1,123
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
5 votes
2 answers
3k views

Shell script of mysqldump works fine when run manually, but does not run in the cron job?

I have a shell script to get a MySQL database dump. This script works fine when run manually #!/bin/sh fqn=/home/Mysqluser/daily_dumps/bookstore_`date +%Y%m%d_%H%M%S`.sql.gz mysqldump -u root -h ...
user120612's user avatar
4 votes
4 answers
2k views

How to use "date" to print tomorrow's day of the week

On CentOS 6 Linux I use date +%a in several cronjobs and scripts to generate logfile names like myprog-Tue.txt and this works well for me since many years. But now for one program I need to delete ...
Alexander Farber's user avatar
4 votes
3 answers
14k views

Simple Linux-based task scheduler with job dependencies? [closed]

I'm maintaining a data-warehousing system that involves a lot of dependent jobs (data import, transform, etc). I've been using Linux's crontab to manage them until the dependency between jobs get ...
huy's user avatar
  • 151
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

1
2
3 4 5
19