Tagged Questions

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

learn more… | top users | synonyms (1)

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
493 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
425 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 ...
32
votes
4answers
25k 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
768 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
236 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
527 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
218 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
365 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
746 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
317 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
425 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
753 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
765 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
617 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
75 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
186 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
325 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
270 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
1k 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
3k 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
188 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
2k 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
337 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
833 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 ...
5
votes
3answers
2k views

Frustrating issue where neither cron nor su -c runs my job (permissions?)

Updated (and snipped) with more details below. I've set up a cron script and I'm trying to debug why it's not running. [Snipped context testing, which is all ok; see revision 2 for details] The ...
2
votes
2answers
495 views

changing default shell to /bin/bash of at job scheduler like in CRON

I recently switched from 2>&1 >> to &>> Is there a way to have at use /bin/bash as the shell? By default it uses /bin/sh and the man page gives no indication how anything else ...
2
votes
2answers
555 views

Is crontab related to server performance?

I am using Solaris 10, and I am adding many cronjobs to my server's crontab. Currently I have 30 cronjobs in my crontab. one cronjob takes 8 hours to complete ,one other cron job takes 5 hours to ...
14
votes
2answers
1k views

Origin of the word cron?

Trying to settle a friendly argument. Is "cron" an acronym for something? Additionally, did it's current canonical name "cron" originate from something shortened for something like chronos or ...
6
votes
2answers
3k views

Logging ALL stderr output of crontab to file

For example, I can log stderr of one script in this way: * * * * * run_script.sh > /var/log.txt 2>&1 But I want to log stderr of all scripts in my crontab. I can append > /var/log.txt ...
21
votes
1answer
5k views

How can I execute `date` inside of a cron tab job?

I want to create a log file for a cron script that has the current hour in the log file name. This is the command I tried to use: 0 * * * * echo hello >> ~/cron-logs/hourly/test`date "+%d"`.log ...
2
votes
2answers
4k views

List currently running cron tab and stop it

I created a cronjob, it runs for a very long time but now don't know how to stop it. Please help.
6
votes
1answer
3k views

Meaning of “* */1 * * *” cron entry?

Somehow, I am finding it difficult to understand tweaking around * parameters with cron. I wanted a job to run every hour and I used the below setting: * */1 * * * But it does not seem to do the ...
5
votes
1answer
1k views

Running cron script with lynx fails to work

I'm trying to automate a login process that can only be done through a browser. I am using the lynx browser to script the actions required to do this. Lynx does this by dumping a user's keystrokes ...
4
votes
2answers
1k views

cifs write errors in cron job

EDIT: THE SOLUTION With Tim's help I determined that larger writes of data were failing versus smaller ones. Why they didn't fail when I ran the script interactively, I don't know...But here was the ...
0
votes
2answers
2k views

Sending cron output to email?

I'm trying to send cron output to an email address and am struggling... I'm running the following command: 13 15 * * 1-5 root /path/to/mysql-backup.sh 2>&1 | mail -s "Daily Database Backup ...
1
vote
1answer
136 views

Can I filter how often cron emails me?

I have a few cronjobs and one of them is run every minute. I had to take a website down for two hours and it caused an error on that one specific cronjob and I got almost 120 emails in those two hours ...
5
votes
3answers
808 views

Crontab job not emailing on failure

I have a cron job on Debian: 1 * * * * /home/paradroid/bin/myscript.sh >/dev/null There is an installed and configured MTA, and I have received emails when the script has a syntax error, so I ...
2
votes
4answers
675 views

Is there any handy command line tool to manage Cron jobs?

Would someone suggest any handy command line (NOT web) tool or script which adds, enables and disables Cron jobs? I am looking, for example, for the following (or similar) behavior: sh manageCron.sh ...
4
votes
2answers
4k views

How can I know when a cron job was killed or it crashed?

Usually when a cron job crash, it will leave some error messages in the log. We run shell script and some java program with cron job. Recently we found some weird thing out from the log. Obviously ...
22
votes
8answers
34k views

How can I run a cron command with existing environmental variables?

How can I run a cron command with existing environmental variables? If I am at a shell prompt I can type echo $ORACLE_HOME and get a path. This is one of my environmental variables that gets set in ...
7
votes
2answers
7k views

Can I change the default mail recipient on cron jobs?

I believe that if there is any output from a cronjob it is mailed to the user who the job belongs to. I think you can also add something like MAILTO=vivek@nixcraft.in at the top of the cron file to ...