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

learn more… | top users | synonyms (1)

1
vote
1answer
351 views

Putty doesn't seem to start from python'd crontab

I have the following Python script, chmod +x'd. When I run this script from the command line and Putty has not been started, it launches putty: #!/usr/bin/env python from __future__ import ...
5
votes
2answers
230 views

How to schedule a job that depends on network availability?

I have cloned a git repository of some project. I want to automate git pull and compile the project once in a week. I am using a laptop which wont be on 24x7. Now, I cannot use cron as I should keep ...
7
votes
1answer
10k views

Why does cron silently fail to run sudo stuff in my script?

I have a script run from a non-privileged users' crontab that invokes some commands using sudo. Except it doesn't. The script runs fine but the sudo'ed commands silently fail. The script runs ...
4
votes
1answer
206 views

Emptying a directory owned by another user weekly

I have a temp directory set up where users can place whatever files they need to send to other users via HTTP. The owner of this directory is an SFTP user, and cannot run cron jobs. I have one shell ...
0
votes
1answer
457 views

cron logging but not working on some commands [duplicate]

Possible Duplicate: How can I execute date inside of a cron tab job? I have a server in Amazon EC2 that I run a backup script on with cron. However, it is not working. To test out if cron ...
5
votes
3answers
3k views

How can I ensure my cronjob will run at specified time?

I'd like to know how I can check to see if my cronjob will run at the specified time I set it at. Is there anyway I can test this without having to wait for that time? Here are my crontab -l results: ...
7
votes
3answers
2k views

Run Script once a day with systemd

I want to run a backup script 10 minutes after booting up my machine but only once a day. Is it possible to build up such scenarios with systemd?
3
votes
1answer
425 views

How do I push a Mercurial repository to BitBucket over ssh? [closed]

I created a public key for ssh and registered that key with BitBucket. I then attempted to push: $ hg push ssh://jhayward@bitbucket.org/johncharrell/[project name] pushing to ...
4
votes
3answers
2k views

What's wrong with these two cron job's?

I have the following cron jobs defined. 55 8 * * 3 /usr/bin/php /home/mark/dev/processes/customClient/events.php > /home/mark/dev/processes/customClient/events-`date +%Y-%m-%d ...
1
vote
3answers
3k views

Why isn't cron running automatically?

OS : Ubuntu 12.04 Now I want to use Backup and Whenever gem to automatic backup my database. When I connect the server by ssh as an added user to run backup perform -t my_backup,it works well.But the ...
5
votes
5answers
3k views

Check if script is started by cron, rather than invoked manually

Is there any variable that cron set when it's running a program ? If the script is running by cron, I'll skip some parts; otherwise invoke those parts. How can I know if the bash script is started by ...
2
votes
2answers
2k views

Cron to delete particular file(s) from a specific directory

I am new to shell scripting. I am trying to write a cron for unix shell that will delete some files, say after 2 weeks or after 1 month from a specific directory. /somedir1/somedir2/ if(somedir2) ...
0
votes
1answer
420 views

Mplayer cronjob doesn't work [duplicate]

Possible Duplicate: How can I execute date inside of a cron tab job? I made a cronjob to record a stream every friday between 23pm and midnight. Only somehow this doesn't seem to work. ...
4
votes
1answer
138 views

In crontab is it possible to specify a user from a variable?

I am trying to have the following cron executed with a certain user. U=`/usr/bin/w | grep -w :0 | awk '{ print $1 }'` */1 * * * * $U /opt/script.sh It seems the deamon doesn't know how to interpret ...
1
vote
1answer
2k views

Run gui application on startup

I can run a script at boot by adding the following line to my crontab: @reboot perl /path/script That works fine. But the problem arises when I try to run a gui application such as gmail notify. It ...
3
votes
1answer
1k views

Maximum Number of Entries in Crontab

If it exists, what is the maximum number of cron jobs (entries?) that can be added to a server's crontab? How do I tell? I'm on RHEL 6. I googled around, but did not see a conclusive answer -- some ...
1
vote
2answers
1k views

Python script to shutdown system doesn't work in cron

A python script to shutdown system works fine from the terminal but doesn't work when included in crontab. The script is called by cron but ends with an error 'shutdown command not found'or 'init 0 ...
30
votes
15answers
4k views

Run unix command precisely at very short intervals WITHOUT accumulating time lag over time

Question I'd like to be able to run a UNIX command precisely every second over a long time period. I need a solution, which does not lag behind after a certain time, because of the time the command ...
4
votes
2answers
286 views

crontab, instance, memory issues+spamming

I have a cronjob that runs php5 wp-cron.php every minute to update my website. However something happened and i had 30+ instance of it (31 is marked on this one dump of ps aux). It ate up my ram, ...
11
votes
1answer
9k views

how can I make cron run a job right now, for testing/debugging? without changing the schedule!

I have a cron job that is scheduled to run everyday, other than changing the schedule, is there any other way to do a test run of the command right now to see if it works as intended?
5
votes
3answers
2k views

What could cause a cron to run twice at the same moment?

I have a cron that is setup to run every Monday at 1 AM 0 1 * * 1 /script/dir/script >> /script/dir/file.log After two years of running as expected, it ran twice on June 18, with the second ...
4
votes
2answers
6k views

Cronjob to run every 30 minutes

I want to set a cronjob entry that runs a script every 30 minutes from 9:00 to 18:00 but I do not want it to run at 18:30. The script should run for the first time at 9:00 and for the last time at ...
3
votes
2answers
2k views

Bash script doesn't work as cronjob

I'm trying to get this simple bash script to work within a cronjob. It's used to generate static nginx webserver statistic pages using GoAccess. I tried everything I know to resolve this issue, it ...
1
vote
2answers
1k views

How can I get crontab to use a different PHP installation location?

I have a MAMP setup which runs PHP 5.3.5 on my Mac OS X 10.5 computer. I am trying to install a crontab that executes a PHP script, which is located on my MAMP server. I can only get the crontab to ...
8
votes
1answer
1k views

Suppress output unless non-zero exit code

What's the best way to suppress output (stdout and stderr) unless the program exits with a non-zero code? I'm thinking: quiet_success() { file=/tmp/suppressed if ! ( "$@" > "$file" ...
1
vote
1answer
175 views

crontab sets up user variable, redirect output, and detect connetcted network

I have three problem, all of them are about crontab. Can I access $HOME variable in crontab ? for example, use $HOME like this: PATH=$HOME/bin:$HOME/scripts:$PATH ? or * * * * * echo "test" > ...
1
vote
1answer
504 views

Crontab with SVN and Git

I have some repos which are both in SVN and Git. My username is guyfawkes, and in my home directory I have folder www which contains all my repos. In this directory I also have file update.sh: ...
2
votes
2answers
430 views

How do I run a program only once per day, while accounting for variable uptime and possible failure of program?

I need to run a command once, but only once, per day, until it succeeds. Continuous uptime cannot be expected, and program success cannot be guaranteed. This program requires network access, but not ...
2
votes
1answer
1k views

Where does the output go from `at` and `cron` jobs

Where does standard output go given there is now screen? It's not appearing in the same directory or my home directory. How could I actually figure this out given that I don't know how to run debug ...
4
votes
3answers
1k views

In linux, would it be possible to run a script every day 3 minutes later than the previous day?

My first solution to this was to execute date +%Y%m%d%H%M and put that format of numbers into a file, and run the script every minute from cron. Then if the date from the file matches the date ...
2
votes
1answer
1k views

Custom directory for cron commands

I'm using vixie cron on Debian/Ubuntu. How to set a custom directory to be read by cron? I want to lead crontab to run commands found in a series of files, e.g. /home/cron/*.cron or perfectly ...
4
votes
2answers
2k views

/etc/crontab permissions

The /etc/crontab file has the permissions: -rw-r--r-- I understand that this file is for system cron jobs and other users should not have permission to modify it. The current permissions allows all ...
33
votes
4answers
27k views

What is the 'working directory' when cron executes a job

I have a script that works when I run it from the command line, but when I schedule it with cron I get errors that it cannot find files or commands. My questions is twofold: When I schedule a cron ...
4
votes
3answers
799 views

What's the purpose of having different crontabs per user?

Is it just for controlling the permissions of the script being called or does it also effect when or if the script runs? I assume if I setup a cron for a non-root user it should always run, even if I ...
3
votes
1answer
243 views

ipsec auto --status fails in cronjob

I have a server monitoring script which, among other things, checks the state of an IPSec tunnel using ipsec auto --status It works like a charm when run from the console (as root) but as soon as I ...
1
vote
1answer
1k views

Trying to create a cron to Rsync then tar the folder

I'm stuck at the first hurdle! I want to run a couple of commands from a bash script. First something like this to rsync some directories: rsync -e ssh -az user-whatever@website.com:/home ...
5
votes
1answer
540 views

Run script when specific users logout

I need to run my application in screen when specific users are logged out and kill the screen when someone from my user list logged in. So I am thinking about bash script, which will be called ...
4
votes
1answer
220 views

How to print the next crontab tasks to be executed?

Is there some way to display a list of the approaching task executions? That is, translate this crontab: # m h dom mon dow command * * * * * imapfilter 4 20 * * Sun fgit gc -- ...
1
vote
1answer
372 views

How to update MOTD regularly?

Every week there's a new work log/to-do list at work. There's a todo script which can be used to extract my own to-do items from that. Currently this is called in ~/.bash_aliases_local, which is ...
1
vote
2answers
759 views

Start and monitor process with CRON

There is a stub application written in C. Now I want to run this application periodically, say at 11.30am daily. I thought of using the cron process but I don't know how to do it. Please help. Also ...
2
votes
3answers
327 views

cron, every minute ram issues

I have a cronjob which runs php on a wordpres cron.php file. Its mainly used to schedule post and i believe it may refresh cache. Anyways... I run the cron job every minute. I checked out the ps ...
-1
votes
2answers
428 views

Centos Crontab not responding

I was learning and experimenting with crontab today. The default editor was just too difficult for me to figure out which caused me to remove my crontab by running crontab -r. Now, when I run ...
3
votes
1answer
2k views

Why does sftp hide the log from stdout?

I have a script a.sh, which has an sftp command: echo "Starting to sftp..." sftp xxx@xxx.xxx.xxx.xx << END_SCRIPT ls mput *.csv.gz bye END_SCRIPT echo "Sftp successfully." If I run it ...
0
votes
2answers
119 views

Testing Scripts

If I have a script called teiid.sh set to run daily by a cron job. The scripts purpose is to initialize the startup of teiid. How would I make a call to test to see the if teiid.sh is working ...
6
votes
3answers
788 views

sort at jobs chronologically

Possibly a simple solution I misplaced. How can I get the output of atq sorted chronologically, so I can easily see who's due to run next? The man page for sort doesn't have anything built-in to ...
3
votes
0answers
787 views

cron is ignoring MAILTO

I have big trouble with cron. On Debian 6, it is ignoring the MAILTO variable. Is there some other variable that has to be to set for cron to send emails to a different email address then local root? ...
2
votes
2answers
635 views

Is there anything in unix crontab to determine this should be executed in PST/CST standard time?

There is this thing in QuartzScheduler where we can say execute this in CST/BST/ or whatever timezone. This is also good when you want to execute some jobs in certain timezones and certain jobs in ...
1
vote
1answer
76 views

Setting up a cronjob as a file

I want to create a cronjob at my Ubuntu server by adding/modifying a file in the /etc/cron.d folder, rather than using crontab -e as it's not too easy to automate. I've managed to make a file looking ...
3
votes
3answers
2k views

How to schedule something run once using anacron?

Frequently within my scripts I schedule auxiliary tasks for later in the form: at now + 8 hours <<< "rm -f workfile.$$ >> $worklog 2>&1 " or at 11pm + $(date +%M) minutes ...
1
vote
1answer
189 views

Creating Cron Task to kill stalled/failed runs in a system

I was given a task to create a cron which finds, kills and clears old puppet runs that were not successfully installed. I am more or less looking for a starting point.