Tag Info

New answers tagged

1

Are you sure It was working well for a couple of days....? This means that a mail was sent every 5 minutes. It could be posssible that the mails could not be sent for some reason resulting in a queue and when the connectivity issue was solved that all the mails were sent. In order to find the problem the mail-log should be checked. The cron should be ...


7

The code samples on that site are erroneous. They have certain shell characters replaced with HTML entities. The quotes also seem to be in the wrong places. I wonder if the author ever looked at that page when writing it... Once we fix that, and then check to see if the first of the month is in two days rather than one... 0 23 27-30 * * [ $(date +\%d -d "2 ...


2

What I understand is your situation: Data is on pg4 and should go to server remote. You have the directory with the data mounted via NFS on mass1. This is what will happen: If you run the rsync on mass1, e.g. rsync -av /mnt/pg4/data user@remote:/data, the data will be copied per NFS to mass1 and then copied to remote via rsync. If you run the rsync ...


0

I had to export more variables, to be the same as in ec2-user environment. I defined a new script ec2-backup.sh as below: #!/bin/sh export EC2_HOME=/opt/aws/apitools/ec2 export JAVA_HOME=/usr/lib/jvm/jre export AWS_ACCESS_KEY=... export AWS_SECRET_KEY=... export ...


0

I am not familiar with WHMCS but if you are running CentOS perhaps you have two instances of crond running. One way to see if that is the case is issuing "ps ax | grep crond" (no quotes) on the command line and see if you get two instances of something like "/usr/sbin/crond". If the crond that read the crontab for the mailing at 12 AM was not killed, it ...


1

The reason your shell seems to hang when you run sudo /etc/cron.daily/apt is the call to random_sleep(). If you comment it out (on my Ubuntu 14.04, it was line 425), you can at least confirm that the script works when you run it interactively.


2

There may be some distro-specific differences, but the largest difference I've found is that cron scripts do not have any sort of default environment settings, while at scripts do. This may be the result of my never using at to schedule a job for after I've logged out, however, so take it with a grain of salt.


1

You could write a shell script to check if hhvm is running if not then start it, write a cron to execute every minute ( This script needs to be executed as root ) PID=/var/run/hhvm/pid if [ ! -f $PID ]; then date echo "Starting HHVM..." service hhvm start fi


0

@Craig Miskell: Thank you for pointing me in the right direction. This is how I solved the problem: First, I added the following lines of code to /etc/crontab: SHELL=/bin/bash PATH=/opt/jdk1.8.0_25/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin MAILTO=root HOME=/root JAVA_HOME=/opt/jdk1.8.0_25 Second, I updated the shell script: ...


0

Since posting the question I have found the same question answered on Stack Exchange: http://unix.stackexchange.com/questions/46789/check-if-script-is-started-by-cron-rather-than-invoked-manually


1

The most likely answer is environment variables, i.e. an interactive shell has a lot (including a rather complete $PATH), whereas for programs run from cron they are typically heavily limited (including an abbreviated path).


1

In CentOS/RHEL, anacrontab is run from cron... so you don't need to do anything. cron.{daily, weekly, monthly} jobs are defined in /etc/anacrontab The anacron command executes jobs defined in /etc/anacrontab Anacron is called from /etc/cron.hourly/0anacron /etc/cron.d/0hourly contains 01 * * * * root run-parts /etc/cron.hourly A little difficult to ...


0

No. anacron isn't a separate daemon that runs continuously. It's started periodically, say daily, by a cron job, does its work, then exits. For example, on my Ubuntu host, /etc/cron.d/anacron contains 30 7 * * * root start -q anacron || : So each time anacron runs, it starts up and rereads its configuration files. So your changes will take ...


0

Check out https://cronitor.io -- it's a simple cron job monitoring tool that will alert you if your job doesn't run, or takes too long to run, or finishes too quickly.


0

check out https://cronitor.io -- you can monitor a single cron job for free. When your jobs run, they ping Cronitor and if Cronitor doesn't get pinged at the right times it will send you an alert.


0

This command is the final solution. It turned out that I was using the incorrect envdir path. I found the correct path by using which envdir when logged into the shell. source ~/.bashrc; /usr/local/bin/envdir /etc/wal-e.d/env wal-e backup-push /db01/pg


0

You forgot to add an user for running that job, correct it: 0 1 * * * root /bin/gzip /syslog/*-$(/bin/date --date='2 days ago' +%F)


1

As Sven said, the better solution would be to use logrotate or similar tools designed for this. However, for sake of explaining there are two problems. You did not specify a user as which the cron should run. And secondly the %F part. You need to escape the %, as described in man 5 crontab: The "sixth" field (the rest of the line) specifies the ...


0

If SELinux is enabled, cron will not be allowed to write into / To see if it is enabled, use: getenforce Try logging somewhere else temporarily such as /var/log/logrotate.log Be sure to look for denies in /var/log/audit/auditd.log assuming that auditd is enabled.


0

Since the answer to my question was posted as a comment instead of an answer, I'm going to answer it myself to help other people find the answer to the question easier. As per Cyrus's recommendation, I changed the above test.sh to: cd /var/www/domain.com/ && /usr/local/bin/wp post create --post-title="test" post-content="testing" ...


1

What do you want to do? The commands you configured normally print the requested website on screen. But cron has no "screen". I would recommed you do something like this to catch the output and investigate it: */5 * * * * curl -s http://www.example.com/cron.php?cron_key=TzVesnZuNqR4mkjv_LgBemUV-oYvsfYalyHOfDtL4cc > /tmp/job1.log */5 * * * * curl -s ...



Top 50 recent answers are included