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

learn more… | top users | synonyms

2
votes
1answer
186 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 ...
2
votes
1answer
1k views

Nice commands in a .sh script for cron jobs

I have this php script that I need to run on shared webhosting. I have created a cron job that executes an sh script. The command for the cron was: /bin/sh /home/user/script.sh So I'm assuming it is ...
0
votes
1answer
3k 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 ...
3
votes
2answers
373 views

find any script which is running for more than say 30 minutes in Linux System

Please share command to find any script which is running for more than say 30 minutes. in Linux System
1
vote
3answers
2k views

Why does this crontab file only run once?

I have the following crontab file: 2 * * * * /bin/date >> /home/jon/date_from_cron.txt I think this means "run every two minutes". However, it only runs once. Shortly after setting up this ...
0
votes
2answers
107 views

crontab email is not working as expected. First I got the emails at gmail, now I'm not getting them

First I ran a simple test to see if I could get crontab to send me an email. I created the following line: MAILTO = my_email_address@example.com 1 * * * * /bin/echo "foobar" This worked as expected ...
1
vote
1answer
95 views

python, cron and the interaction with Growl

I have the following python file called temp.py import subprocess p = subprocess.Popen('growlnotify -m \"Program is not running\"', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) ...
1
vote
3answers
352 views

cannot access crontab with sudo after being added to /etc/sudoers list

My user "craig" is in the /etc/sudoers file on my CentOS 5.6 VM, however when I try to access the crontab using the command below I am presented with an error message: sudo crontab -e -u ...
0
votes
1answer
606 views

Crontab is using some sort of hidden cache?

I used to have a crontab that ran like this * * * * * /usr/bin/php /var/www/vhosts/default/htdocs/agent/time_keeper.php > /dev/null 2>&1 It worked fine. Now I moved that php script to a ...
1
vote
1answer
87 views

Script acts differently whe run by cron

I have a script that runs nightly, that is returning different results than when I run it manually. I realise that this is a common question and my problem most likely lies in an environment variable ...
1
vote
2answers
798 views

How do I run a rake task in cron under a different user?

I'm trying to run a backup script on ubuntu. My problem is that I'm trying to do this using the postgres user account that I setup on ubuntu. I believe having this account run the cron jobs is best ...
0
votes
1answer
221 views

Cronjob does not work

I tried to set up a cronjob on my server. Actually this command should execute a java programm every hour. But somehow this didn't worked. I googled and tried to set up a test-script that should run ...
0
votes
2answers
711 views

Error setting up Crontab

Trying to set up a cronjob: 0 12 * * * /usr/bin/mysqldump --all-databases > /backups/mysql/`date "+%Y-%m-%d"`.sql Getting error: crontab: installing new crontab "/tmp/crontab.fuly8s":2: bad ...
1
vote
1answer
3k views

CRON what is correct time code for every 6 hours?

I just want to know which one should work just fine for Run every 6 hours forever: 0 */6 * * * or * */6 * * * Thanks
0
votes
1answer
268 views

Why is this CRON failing to execute?

$ crontab -l # # m h dom mon dow command SHELL=/bin/bash * * * * * (/usr/bin/curl -s -XPOST http://internal.ip -H 'Content-type: application/json' -d 'data') $ ls -l /usr/bin/curl -rwxr-xr-x 1 ...
2
votes
1answer
424 views

How do I ensure a process is running, even if it kills itself? (it needs to be restarted then)

I'm using linux. I want a process (an irc bot) to run every time I start the computer. But I've got a problem: The network is bad and it disconnects often, so I need to manually restart the bot a few ...
2
votes
1answer
558 views

Make shell script commands to abort after certain timeout

I have often a situation in Linux shell scripts that if a specific command takes too long to run e.g. due to a network problem the shell script should abort running this command. What best practices ...
1
vote
0answers
95 views

script executing perfectly in terminal but not in cron

I setup a script for to take an mysql db backup everyday on a specific time, so now the cron is running perfectly it executing the script without problem but the problem is db backup file is not ...
2
votes
2answers
237 views

Automatically commit a file to git

Is there a way to easily commit a file to git if it has updated? I want to take a list of files in a directory, write it to a text file, and commit it to git if it's changed. I assume this would ...
1
vote
1answer
275 views

why can't I start a program directly from cron?

I'm currently setting up a raspberry pi running Debian wheezy as an IRC server. It runs two programs as a regular user on boot - ngircd and atheme. ngircd and atheme both log to /var/log/syslog ...
1
vote
2answers
131 views

Rsync to take the newest file. And a cron job?

I have a log file on two different servers. The servers are under a load balancer so half the traffic goes to one server, and half the traffic goes to the other server. I need to take the newest log ...
1
vote
3answers
347 views

run cron on ssh, error message

how to run the script below * * * * * /usr/bin/wget -O - -q "http://example.com/scheduler/cron" when i run the script, the error message show as below: $ * * * * * /usr/bin/wget -O - -q ...
3
votes
3answers
3k 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 ...
1
vote
1answer
240 views

How do I fix my crontab after a username change?

I recently changed my username, and I can't seem to access my crontab now: % crontab -e crontab: no crontab for blackl - using an empty one I thought I'd just edit the one I had under my old ...
2
votes
2answers
138 views

easy way to automatically retrieve image for desktop background?

I would like to automatically download and replace an image from the NASA website to use as my desktop. in linux i used a cron job to do this, using wget to retrieve the file and a small utility to ...
4
votes
3answers
4k views

Running mysql dump in a cron job without exposing passwords

I want to run mysqldump -u aUser -p P4SSw0rd --all-databases > backup.sql in a cron job. How can I do so securely? I know I could put the command right there, but anyone with access to the ...
0
votes
1answer
135 views

Cronjob using the mail function

When I run this mail command from the terminal, there's no problems: mail -s "Test Mail" user@example.com < home/user/example.txt When I add it to a bash script that mainly does this, there's no ...
1
vote
1answer
285 views

Difference between 0,10 and */10 for crontab?

I wanted to run a cron every 10 minutes. What's the difference between the syntax 0,10 and */10?
38
votes
3answers
934 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 ...
0
votes
1answer
315 views

Make crontab work at 0 hour

I try to execute some command like this: */10 0,1 * * * $BPY some_script.py Meaning I want to run it every 10 minutes between 0:00 and 1:00. BUT: I see in my /var/log/cron that it is not executed. ...
0
votes
1answer
1k views

How can I save a cron job?

I have connected via ssh and have added a cron job but I can't figure out how to save it. I'm still on the crontab -e page how do I save my changes?
0
votes
0answers
32 views

This weird behaviour from cronjob

I have set the crontab like this: */5 0 * * * /www/permitChat.sh and the /www/permitChat.sh is this: # We are setting the name of file # in the variable along with complete path. sFilePath=`date ...
2
votes
1answer
984 views

Cron jobs are running but there is nothing in crontab? Have I been hacked?

I have a server that's been running for years now and there are no cron jobs set up. I have not logged in or changed anything in months. Suddenly I started receiving emails that look like this, about ...
0
votes
1answer
353 views

Crontab No such file directory

I'm trying to run an hourly python script. My crontab looks like this: crontab -l 0 * * * * "/common/.../www/concat.py /common/.../www" as an output I get this: /bin/sh: /common/.../www/concat.py ...
3
votes
1answer
72 views

What does this crontab line do?

What does this crontab entry do? I'm thinking it means run the jobs.sh script every Monday at 11AM. Is this correct? 0 11 * * MON /home/username/jobs.sh
1
vote
1answer
1k 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 ...
1
vote
3answers
651 views

cron ignoring environment variables?

This should be simple, but it doesn't seem to be working. I have a very simple script run by cron: export MAILTO=foo@foo.com MAILTO=foo@foo.com echo "MAILTO is set to $MAILTO" Cron, however, seems ...
2
votes
3answers
804 views

Cron job outputs HTML; how to send mail as HTML

I have a cron job that if it fails outputs HTML. If it succeeds it outputs nothing, in which case I get no mail. If it does fail and write HTML, cron sends me the mail but it comes as plain text and ...
0
votes
1answer
95 views

Crontab as other user

I am running crontab as root user: screen -S konsola -X stuff 'say hello'`echo -ne '\015'` How do I run it as the user "nobody"? Only this user has screen with given pid, thats why I need it.
3
votes
1answer
2k views

Two parts: 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 ...
0
votes
1answer
602 views

Ubuntu Precise cron.daily issue

I have a very strange problem. I've placed a script into /etc/cron.daily on my Ubuntu 12.04 server, gave it the appropriate permissions (0755), and assumed it would run correctly. I guess that was too ...
1
vote
1answer
437 views

“killed” message from cron.daily, but not when run from command line

On Fedora 17, I put a file into /etc/cron.daily with the following contents: cd / su dstahlke /home/dstahlke/bin/anacron-daily.sh exit 0 For some reason, I get a mail every day that just says ...
1
vote
1answer
501 views

Run Cron every 2 minutes in 30 minutes?

I need to run a cron job every 2 minutes (*/2) but only for the first 30 minutes of every hour, with pause of 30 minutes between the runs. For example, something like: From 10h00 to 10h30: run ...
1
vote
2answers
3k views

Error in Ubuntu, what does this mean?

Got this on my machine. I was just browsing the web on Chrome and my computer froze. I recently just built this machine. I have a feeling it is a hardware problem... Possibly one of my parts arrived ...
1
vote
2answers
518 views

Backups over SSH via Cron - which user?

I'd like to use rsync to regularly backup content from a production website to a backup server. The content being transferred from the remote system has a variety of permissions and owners assigned. ...
1
vote
1answer
822 views

Are there good reasons to have a single cron job run multiple comands [closed]

How would cron handle a job that executes multiple commands. As an example I have a cron job that looks like this. Which gets very difficult to read. 10 0 * * * firstscript.sh > first.log; ...
1
vote
1answer
193 views

crontable OR conditions

Crontable parameters seem to function as 'ands' conditions. So the example 0 9-5 * * 1-5 Runs when the conditions are met "minute is zero AND hour is between 9 and 5 AND day is between monday and ...
0
votes
0answers
149 views

Will my weekly cron job work?

I'm just getting back into bash scripting and I want my cron job to run every 15 minutes between 9.15 and 10 PM. I've checked the script works, but I don't know if it's the right command: ...
5
votes
2answers
4k views

ssh Permission denied only in cron job

Having a very strange problem. I've created a small bash script which runs a command on a remote host via ssh (using public key authentication). When I run this script manually from the command line ...
4
votes
2answers
686 views

Auto suspend after X minutes to stop myself procrastinating

Right now, I'm using a line in /etc/crontab to run pm-suspend every 30 minutes, but I would like an application displaying a warning before suspending (for example a countdown in the taskbar). An ...