Cron is a time-based job scheduler in Unix-like computer operating systems. Cron enables users to schedule jobs (commands or shell scripts) to run periodically at certain times or dates.

learn more… | top users | synonyms (2)

15
votes
4answers
15k views

Is there a way to validate /etc/crontab’s format?

I prefer to stick scheduled tasks in /etc/crontab so I can see at a glance what's scheduled to run, regardless of which user the task runs as. The only gotcha is that the format isn't validated on ...
1
vote
1answer
22 views

How to correctly edit /etc/cron.d/* files?

When I used crontab -l and crontab -e I re-scheduled my cron timings, but found they were still firing at the previous interval. I then discovered cron-format files under /etc/cron.d/ which ...
0
votes
0answers
9 views

script from cron vs. standalone [duplicate]

I know it is an old topic. I have a script i can run it from terminal, but it doesn't work when i try to run from cron even i used relative path to files. The script runs an SQL query, and save the ...
0
votes
0answers
31 views

Crontab is not working. How do I troubleshoot it? [duplicate]

Fixed by removing SHELL="/sbin/nologin" line. Crons are being called, as Logwatch report indicates. But nothing is actually executing. Neither cURL nor php -q Here's my crontab -u user -l : root@...
0
votes
4answers
1k views

Check if remote mysql is running

I want a bash shell script that i can run using a cron job to check if mysql on a remote server is running. If it is, then do nothing, other start the server. The cronjob will be checking the remote ...
-1
votes
2answers
15 views

Can PHP have not root permissions, if it is runned via root cron job?

In /etc/crontab i see a job like this: 15 15 * * * root /usr/local/bin/php /path/to/script.php So, with some other settings, cat this php script have not root access, when runned? My ...
2
votes
3answers
927 views

crontab fails, cannot find aws executable [duplicate]

I am trying to run a backup script on my ec2 amazon server (ubuntu 14.04), to automatically create a snapshot of amazon ebs volumes. Therefore I am using the aws-missing-tools script: https://github....
-1
votes
1answer
48 views

Cron job for let's encrypt renewal

Is this correct way to set cron for renewal of Let's Encrypt cert in Apache2 ? I use Ubuntu 16.04. @monthly letsencrypt renew && service apache2 reload
0
votes
1answer
38 views

nginx stop logging after crontab modified the log file

I have a web server(django) running on nginx + gunicorn. nginx writes its regular logs to: ~/myproject/log/access.log and it writes errors to: ~/myproject/log/error.log it works pretty well for ...
0
votes
1answer
57 views

bash script works correctly but skips commands in cron if I am not logged in via ssh or I was connected recently

I am trying to schedule some backup scripts in cron on a CentOS release 6.7 (Final). This is the full backup, basically mounts a remote directory, checks if there is enough space available for doing ...
0
votes
1answer
24 views

Trouble getting duplicity + cron + shell script to play nicely together

I'm not sure if this is more appropriate here or over in Stackexchange so sorry if I got it wrong. I was wondering if I could get some help: So I'm trying to use cron to run my shell script which ...
0
votes
0answers
7 views

Detect failing USB hard drive automatically [migrated]

I Have a Raspberry Pi which has one USB external hard drive attached to it (via a separatly powered USB hub). The thing is that sometimes this disk becomes unresponsive (I can't access its mounted ...
1
vote
3answers
2k views

Capturing output from a remotely executed command via SSH fails in CRON

This question is in a direct relation to this one: ssh fails to execute remote command when run from cron bash script - works from CLI I'm not able to comment on the accepted answer as I don't have ...
0
votes
0answers
20 views

Different behavior of the cron [duplicate]

I have a script (seekCustomers.sh), which perfectly works from the command line: #!/bin/bash echo "Hello" The script is owned by non-root user. I want to put it on schedule using cron daemon. So, ...
0
votes
1answer
17 views

URL encoding issue with cron and wget

I have a simple bash script: #!/bin/bash wget -q 'http://requestb.in/1fq0r3s1?foo=a%2Bb' -O /dev/null If I run this from the commandline and then inspect at http://requestb.in/1fq0r3s1?inspect I ...
28
votes
6answers
5k views

Outgrowing cron: what's the next scheduler?

We've been using cron for about as long as I can remember to handle all of our job scheduling needs. Everything from storage clones/snapshots to reports against databases to daily system reports to ...
1
vote
4answers
1k views

shell script in crontab, not all output being logged

I've got a simple shell script that runs a few LFTP commands and processes the files. When running straight from bash I get full output of those LFTP commands on screen. When running from crontab ...
0
votes
1answer
1k views

Compress and remove logs from jboss on linux with cron

I need to compress and remove log files after some time from serwer. I have never write scripts before. So far i have script logs.sh: #!/bin/bash LOGS=/usr/local/jboss/server/default/log/ INFOLOG="...
2
votes
1answer
335 views

How to use “keep_environment” option in exim 4 on Debian

I am running exim 4.84_2 on Debian, now since a few weeks I get the following mails from anacron: /etc/cron.daily/exim4-base: LOG: MAIN Warning: purging the environment. Suggested action: use ...
21
votes
8answers
51k views

How to disable everything in crontab -l?

I just want to pause everything. Don't execute anything listed on crontab -l.
11
votes
5answers
14k views

Using mysqldump in cron job without root password

If I login with the root password on my box I can simply type mysqldump --all-databases and I will get th expected "Dump". I setup a job in cron.daily to run and dump this to a backup drive. The ...
9
votes
3answers
14k views

How To Backup “crontab -e” Files?

I want to do a complete server backup. I already have my backup script copying all of the html/php files for the web app, and the mysql databases, placing them into a .tar.gz file. How can I add the ...
0
votes
2answers
33 views

cron job executing script not writing to file

I have a server running AIDE, and a cron job that runs executes a bash script and sends an email alert out. It is still a WIP, but I can't get the script to run properly. When the script is executed, ...
0
votes
0answers
23 views

Cronjob won't run PHP script on Linux PBX server but I can run the script manually [duplicate]

I have a cronjob that runs every Monday at 7:45 am. In the crontab, this is the line: 45 7 * * 1 php /script/php-code/parse.php "/script/php-code" On a different Debian 8.4 server, I have the ...
1
vote
2answers
2k views

Setting 'From' header for cron email using msmtp

I've got msmtp setup on Ubuntu 10.10 so that cron can send me emails. That works like a champ, for the most part. However, emails coming to my gmail account show up as coming from (unknown sender), ...
1
vote
1answer
38 views

Getting my server maintenance script right

I have two routine postgresql maintenance tasks that require deletion of aged rows from certain tables of my web application. Both take ~1 hr to complete, respectively. Currently, each of these ...
1
vote
2answers
24 views

How do I include the password for the user 'postgres' in a maintenance script?

I'm setting up a cron job to do some routine maintenance for a postgresql database. The script is as follows: #!/bin/sh dbname="dbname" username="postgres" psql -d $dbname -U $username << EOF ...
0
votes
5answers
1k views

munin-cron Unable to Copy Contents

I recently installed munin on my (Fedora12 based) server. Now, I wanted to get all the graphs in a static directory (The application runs on Django). So, I edited the file /etc/munin/munin.conf by ...
2
votes
1answer
31 views

Anacron fails to open folder cron.daily

Recently I switched from user-specific anacrontab ( using -t ) to the global-one. Now each day anacron drops me a message (email to root) that it failed to open the cron.daily folder: Subject: ...
5
votes
6answers
5k views

s3cmd run on command line not on cron

Many have said that the problem is with environment but I still can't seem to solve this problem. BTW I am using Ubuntu 9.10 login as user, then sudo -s using this command: s3cmd put file s3://bucket ...
0
votes
0answers
19 views

Time to run znapzend job

I have setup znapzend and have created the following job: /opt/znapzend/bin/znapzendzetup create --recursive --mbuffer=/usr/bin/mbuffer --mbuffersize=1G \ > --tsformat='znapzend-%Y-%m-%d-%H%M%S' \ > ...
1
vote
0answers
40 views

Cron not logrotating for cron.daily

I'm running a rhel7 server and I have a rsyslog logrotate config file that doesn't seem to run using cron job. It will only work if i run it manually Troubleshooting steps i took: logrotate -df /etc/...
2
votes
4answers
2k views

For tripwire, how would I have the report e-mailed only when a violation is found

My ideal solution for tripwire reports would be: Daily e-mails would only generate if a violation was found Every Sunday, a report would be e-mailed regardless of whether a violation was found I'm ...
0
votes
1answer
19 views

Adding cron jobs using crontab from several different files

I have two files where in I have listed my cronjobs: cron.dev1.txt cron.dev2.txt Now I am using crontab in the following manner: crontab cron.dev1.txt and crontab cron.dev2.txt When I do ...
0
votes
1answer
28 views

Cronjob change email subject and sender name

I have a cronjob setup using crontab that looks like this... MAILTO=myemail@example.com 00 02 * * * /home/myaccount/myscript.sh This works great and at 2AM it runs the script and emails me the ...
0
votes
2answers
71 views

Cron is retrying a job every 15 minutes

I have an Amazon Linux AMI with this in crontab: 0 7 * * 1 root /usr/bin/wget -q http://localhost/digest_weekly.php -O - >> /var/log/digest_weekly.log This calls the script digest_weekly.php ...
29
votes
7answers
19k views

Can I run a cron job more frequently than every minute?

Is it possible to run a cron job every 30 seconds without a sleep command?
1
vote
3answers
109 views

How to set MAILTO in cron using Puppet?

The expectation was that there would be a mailto attribute, but the this source denies that cron { 'resource title': name => # (namevar) The symbolic name of the cron job. This name is ...
-2
votes
1answer
40 views

Write Python Output to File in Cronjob

I have a script (/home/user/script.sh): #!/bin/bash /usr/bin/python /home/user/program.py >> /home/user/logs/out.log & and it is working. The output from the python script is written to ...
0
votes
1answer
173 views

Unable to start cron service [duplicate]

Few days ago I added a cronjob using crontab -e which should run every 6 hours, however I noticed that cron job is not working. When I execute my script manually it works, and it should write some ...
0
votes
1answer
38 views

How can I list all cronjobs created by puppet?

I have several crontabs defined in a pp file, e.g: cron { 'puppet-cron1': ensure => present, command => "cat /etc/issue", user => root, minute => '*/30', } cron { '...
28
votes
5answers
29k views

How can I monitor what logrotate is doing?

How can I monitor what logrotate is doing in Ubuntu? Can the activity of logrotate be monitored?
0
votes
0answers
40 views

Elastic Beanstalk and Worker Tier? (PHP)

I'm trying to setup my app that's hosted on EB with a worker that will run some basic cron jobs to feed an RDS database with data that the app consumes. I deployed this cron.yamlat first: version: 1 ...
0
votes
1answer
59 views

%CPU at 99% when cronjob runs php script every minute

I am using a debian server and for some reason when I run this php script using crontab every minute it says that I am using 99% of the %CPU with the php command (in the cronjob the command is php) ...
27
votes
3answers
17k views

What does * * * * * (five asterisks) in a cron file mean? [duplicate]

The first noncomment line in a legacy crontab file begins with five asterisks: * * * * * ([a_command]) >/dev/null 2>&1 The authors are gone, so I do not know their intent. What does all-...
0
votes
0answers
43 views

Error in crontab file: bad day-of-week

When I run crontab -e on my Debian server and add these lines: # System statistics */10 * * * * /usr/lib/sysstat/sa1 1 1 > /dev/null 2>&1 59 23 * * * /usr/lib/sysstat/sa2 -A > /dev/null ...
1
vote
0answers
23 views

OOM using CRON but not using SHELL

When I start a java program by shell, everything is working well. However if I start the same program with the same command and same user by CRON, I get a java.lang.OutOfMemoryError just after a few ...
0
votes
1answer
48 views

Cronjob starts multiple processes

Cronjob creates multiple processes for the same script. One using /usr/bin/php /path/to/php/script And other using /bin/sh -c /usr/bin/php /path/to/php/script These are 2 separate ...
0
votes
0answers
24 views

Find Unknown Predicate JailedShell

Well, after months experimenting with ', ", and \" it seems i cant find the right pattern that could generate the correct code for a cron job on a jailed shell. I got this code below works on jailed ...
5
votes
3answers
21k views

How to fix a crontab access issue with a pam configuration error message? [closed]

I attempted to access my crontab as the non-root user "coins" when I encountered a permissions issue as shown in the following error message mentioning the pam configuration: [coins@COINS-TEST ~]$ ...