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

learn more… | top users | synonyms (1)

2
votes
3answers
1k 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
2k 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
4answers
2k 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
743 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
319 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
130 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
1k 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
916 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 ...
29
votes
14answers
3k 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
233 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, ...
8
votes
1answer
5k 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
981 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
3k 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
1k 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
781 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
834 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
150 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
393 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: ...
1
vote
2answers
367 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
749 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 ...
1
vote
1answer
604 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
986 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 ...
19
votes
4answers
14k 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
536 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 ...
2
votes
1answer
186 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
961 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
395 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
188 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
291 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
579 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
277 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
397 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
1k 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
118 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
527 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
491 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
516 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
72 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
1k 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
177 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.
1
vote
2answers
275 views

need portable crontab host-checking/failover logic across Linux & Cygwin

A host-ping test that always works correctly from the interactive bash command line in Cygwin, is behaving incorrectly in its own crontab--always selecting the second host--and I can't figure out why: ...
0
votes
0answers
197 views

Facing issue with cron on embedded linux

I have a SAM9 based board running embedded linux using buildroot package. I added the crond and crontab support to busybox from make menuconfig and built the rootfs and flashed it to my board. The ...
10
votes
1answer
978 views

What does the following kernel message mean?

The following appears /var/log/messages, what that means ? Feb 19 22:51:20 kernel: [ 187.819487] non-matching-uid symlink following attempted in sticky world-writable directory by sh (fsuid ...
6
votes
1answer
2k views

What's the meaning of the slash in crontab?

I have seen a crontab record in system. 0-55/5 * * * * root <command> I read the crontab -e example files and I know the first position stands for minute. But I cannot figure out the ...
1
vote
1answer
173 views

Crontab Change location

I want to set a personal crontab in another folder and executed. For example I want it in /home/project/tasks/crontab Like that it's easier to add/delete tasks. Thank you for your answers.
0
votes
3answers
1k views

I want to set up a basic cron job that sends an email

I am running OS X 10.7 and I am learning unix commands. I would like to set up a very basic cron job that sends me an email with a certain message. How would I go about this. From what I have read, I ...
1
vote
1answer
279 views

How to create a cron which finds/kills/clears old puppet runs?

I am a new user of bash/cron, and I was given a task to create a cron which finds/kill/ and clears old puppet runs that were not successfully installed. The more help the better, but I am more or less ...
3
votes
4answers
526 views

command for counting number of active cron jobs in crontabs

Problem statement I have 5 solaris boxes, some have Solaris 10 and some have Solaris 9. All of them have many cronjobs in their crontabs. I would like to know number of active cronjobs available, so ...