3
votes
3answers
82 views

How can a sh script determine if it was started as a cron job as opposed to interactive or background?

I'd like to use the same scripting for cron and interactive, just wondering if there was a universal way over UNIX/Linux systems to easily make this determination.
2
votes
1answer
61 views

schedule a job to run only “once” after 50 seconds

I have a process which is designed to do a specific task in case of events. Requirement is to run a specific command 50 seconds after an event occurs. Cannot modify the code to put sleep there as it ...
-1
votes
2answers
708 views

Running multiple cron jobs from single script

I have three different jobs that I want to run from the FreeBSD shell. I would like to consolidate them into a single script, if possible, but I can not find any syntax to do that. Is there someway I ...
0
votes
1answer
253 views

Cron permissions?

I have a bash script which if I run manually (as root) performs all of its tasks without issue. The tasks are just a few php scripts and then a "mv" to move the process file to a temporary folder. ...
5
votes
1answer
372 views

Anacron and fcron, what are the differences?

Anacron is a computer program that performs periodic command scheduling which is traditionally done by cron, but without assuming that the system is running continuously. fcron is another ...
1
vote
3answers
3k views

Why is crontab giving “No such file or directory” error when the file DOES exist?

I am getting the following three lines in an error message in /var/mail/username after the following job runs in crontab... 15 * * * * ...
0
votes
5answers
983 views

Distributed cron

I maintain many servers and have the following requirements Run a unix process at a given time Run a unix process at boot time and keep it running (in case it dies) Disable a running process I am ...
0
votes
2answers
185 views

Cron daemon's status check on production server

I have a script which need to be run as cron job. In the staging environment i could run the script as a cronjob. but in the production environment it is not working, so i checked whether cron ...
0
votes
2answers
108 views

cron time is not correct or cron is running with delay

my cron jobs are executed half an hour later than when they are supposed to. Does cron refer to the system time when it executes its jobs or refers to its own time(if it has one)?
4
votes
4answers
1k views

Bash script is not working as cron job

I have the following shell script $cat capture.sh TIME=$(date +"%H-%M-%d-%m-%y") IP="203.208.198.29" PREFIX=$TIME$IP tshark -f "udp" -i eth0 -w /root/captures/$PREFIX.cap& pid=$! sleep 2m ...
1
vote
3answers
3k views

Does /var/spool/mail/user ever get cleared?

I have a crontab task running every 5 minutes. It writes an output (result of the .sh file run by the crontab) to the /var/spool/mail/user. Should I be worried that this spooler will build up and slow ...
8
votes
4answers
702 views

Analyze and optimize crontabs [closed]

Is there a tool to graph, analyze and help optimize crontab execution? To clarify, I'm thinking of a tool which would generate a graph of when cron jobs are executed, and help the sysadmin reorganize ...
0
votes
3answers
856 views

I deleted my cron jobs from cPanel, but it's still working. How to stop?

Got a problem. I created a cron job via cPanel and after what deleted it, but it didn't stop working. Anyone knows how to stop my crons?
0
votes
3answers
119 views

apply unix permission scheme on directory structure

I like to fix permissions on our fileserver via cron. In general I like to set everything to umask 027 ignoring any changes a user did. For certain subfolders I like to apply umask 077. The question ...
0
votes
2answers
798 views

Change Other Users Crontab

I've got a (deployment) script, that runs under my user 'me' and it should change the crontab of user 'ruby-server'. Am I right that the -u option (of crontab) doesn't help me much unless I use sudo ...
0
votes
1answer
278 views

Curl doesn't work in crontab

I'm new to set up server settings and to the whole unix thing so maybe this is simple. I'm trying to start crontab with curl in but it doesn't work. I want it go to file and send email every 30 ...
0
votes
2answers
411 views

Cron process not starting

I have an ec2 image created with cron jobs. These jobs fail to run; I discovered the cron process in itself has not started. So, I included /usr/sbin/cron in /etc/rc.d/rc.local and created another ...
1
vote
3answers
148 views

Test a cron task

I just created a cron task do a backup of a 10GB MySql file once every week. How do I test it? Specifically it should run as the user, do the output email and error log of the cron task
2
votes
3answers
615 views

Why does my backup script work when I run it, but not when it's run via cron?

This is my script, backup_mongo.sh #!/bin/bash suffix=$(date +%w) rm /home/myuser/backup/mongo-$suffix -rf mkdir /home/myuser/backup/mongo-$suffix mongodump -h$1 -u$2 -p$3 -dmydb ...
2
votes
3answers
2k views

What minimal SMTP client will allow me to relay cron output to an external email address?

I would like to have cron output sent to an external email address, via a minimal SMTP client that sends via Gmail. I think I need this client to support TLS and /etc/aliases, and I would like ...
2
votes
1answer
222 views

Why does the time it takes to run this script differ so much between user and system and how I might correct the discrepancy?

My application sits behind a load balancer, and every once in a while I like to do a status check on each machine to get an idea of the time it takes to return an index.html document on each machine. ...
-4
votes
6answers
122 views

Help with UNIX Crontab! [duplicate]

I want to shedule a task for 8.30am every Monday, for every month, for every year... What would the UNIX Crontab format be? Many thanks O.
0
votes
2answers
432 views

UNIX cron job doesn't run on all of it's schedules, acts like it's running previous version?

We have a solaris box that is running a script via cron. It is scheduled for 00 5,19 * * *. The problem is, the script runs just fine at 19 (7pm) but is not running at 5am. There are no errors, ...
2
votes
3answers
5k views

Can I restore accidentally deleted crontab entries?

I was trying to create a cron on the production environment and so I created crontab.txt file with my new cron command and ran crontab crontab.txt file but instead of appending to existing cron job ...
0
votes
3answers
269 views

how to make a special cron job?

i need to make a cron job to run a java program every 40 minutes on unix server. considering that: 1)it should run from 8h30 to 12h30 and from 14h to 18h from monday to friday 2) take ...
1
vote
2answers
606 views

Visudo All Password Less Access to Script (Visudo + Cron)

I want my user 'dave' to be able to run a bash script without entering a password, so the script can run with crontab? For all other activities I'd like this user to be required to enter a password ...
1
vote
1answer
2k views

How to delete all local mail from a system account?

The root mail account has been blown up by mischieveous cronjobs, and I want to completely delete the mail from the account. Is there a key for that in the mail command? I deleted /var/mail/root but ...
0
votes
2answers
656 views

In Amazon EC2, how do I make it run a python script when I “clone” that instance?

Suppose I have a script in /home/myuser/go.py How do I run that script, when a new instance is booted? (I'm used to using the point-and-click control panel Amazon has...)
1
vote
1answer
464 views

crontab: question about a special case of the dash character in the time field spec

In the SuSE /etc/crontab the entry to run the cron.{hourly,daily,monthly,weekly} scripts is coded as: -*/15 * * * * root test -x /usr/lib/cron/run-crons && /usr/lib/cron/run-crons ...
0
votes
2answers
640 views

Why doesn't this cron work?

I do "crontab -e" and add the following line: 0 9 * * * /usr/bin/python /home/g1/g1/utils/statsEmail.py > /home/g1/log/statsemail.log But it doesn't work! Why? The script itself ...
0
votes
2answers
1k views

What do these “Cron Daemon” email errors mean?

Anyone know what this means? Getting one of these every minute in one user's inbox: From: Cron Daemon <joe@mail.domain.com> Subject: Cron <joe@mail> /tmp/.d/update >/dev/null ...
9
votes
2answers
5k views

Better logging for cronjobs? Send cron output to syslog?

I am looking for a better way to log cronjobs. Most cronjobs tend to spam email or the console, get ignored, or create yet another logfile. In this case, I have a Nagios NSCA script which sends data ...
1
vote
2answers
5k views

how to run cron job every 3 months in apache2?

how to create a cron job that run in first day of the month , every 3 months.? thanks
2
votes
2answers
889 views

L character in Cron Expression for “Last Day of the Month”

I'm currently writing an article on cron aimed at people who are familiar with the tool, but don't necessarily use it often. I want the examples to be compatible with most common Unix desktops in use ...
1
vote
2answers
2k views

How do I find and delete a cron job?

I created a cron job for a wordpress plugin that i no longer want running. I am not very good at navigating around in unix. The cron job was the following: */10 * * * * /usr/bin/wget -O /dev/null ...
2
votes
4answers
569 views

Cron not running my Python statement

I have the following entry in crontab: * * * * * python -c "import datetime; datetime.datetime.now()" >> /home/myname/pythoncron1.log The pythoncron1.log file is being created but has nothing ...
1
vote
2answers
270 views

Automating a multi-tape cpio backup

Currently, I have a simple backup process in which a script is run daily via cron. If there's a tape in the drive, it will use cpio to backup critical files, with a full system backup done once a ...
1
vote
2answers
2k views

What day/time does a weekly cron start on?

I had a look though the cron man but didn't find anything that helped :( Anyone know?
1
vote
2answers
702 views

CRON job erratic behavior with Bourne shell script

I have the following script, that runs normally when I type the script name at the prompt (logscript): #!/bin/sh dvar=`date +"%m\/%d\/%y"` filedate=`date +%b%d%Y` echo DSS1 > ...
7
votes
4answers
13k views

How to disable everything in crontab -l?

I just want to pause everything. Don't execute anything listed on crontab -l.
2
votes
2answers
334 views

Two scripts in /etc/cron.daily seem to be rotating my logs: logrotate and sysklogd

It seems that my logfiles generated by syslog are getting rotated twice each day. I believe this is due to both /etc/cron.daily/logrotate and /etc/cron.daily/sysklogd doing overlapping work. Here are ...
1
vote
3answers
914 views

Change the shell for cron job

I have a zsh script that I would like to run via anacron every week. It runs fine from an interactive bash shell, but when run by anacron, I am getting command not found errors and it looks like it ...
2
votes
5answers
242 views

how to create a cronJob run every 0.25 hour

How do I want to create a cron job on Linux that runs every 0.25 hour?
0
votes
7answers
772 views

vi syntax to comment out non-commented lines (cron)

Anyone know if it's possible in vi to replace only uncommented/non-blank lines with comments? If I want to replace a commented line with something I know I can use :%s/^#/##foo##/g -- but I am ...
2
votes
8answers
731 views

How to run a cron job?

I have a sample perl script which i need to run using cron daily ,could any one let me know the exact syntax to use cron job. Thanks in advance.
5
votes
5answers
2k views

What's the best way of setting up a cron job to check that a long-running process is still going and if not, start it?

As per the title: What's the best way of setting up a cron job to check that a long-running process is still going and if not, start it? If I start a long-running process in cron, is it going to ...
24
votes
7answers
40k views

How to get e-mail from (failed) cron-jobs in Ubuntu?

I create cron-jobs in Ubuntu by placing the executable in one of /etc/cron.{daily,hourly,monthly,weekly}. There are lots of directories starting with cron: kent@rat:~$ ls -ld /etc/cron* drwxr-xr-x 2 ...
2
votes
2answers
236 views

Move oldest file via cron

I've got two directories. /application/inbox /application/unresponsive The application looks for *.txt files in the inbox and works with them. Periodically the application will save entries from ...
2
votes
7answers
541 views

Windows cron jobs

Does Windows have an alternative to cron jobs? I'd like to schedule a task to run every morning at 6. EDIT: I want to do it on the command line for use in a batch script.
12
votes
3answers
5k views

Override MAILTO for a single crontab entry

We have a role account at work that has a pretty big crontab. Its MAILTO is pointed at a shared address, so that a number of us get notified if something fails. I'd like to add an entry to this ...