Questions tagged [cron]
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.
1,965
questions
-1
votes
0
answers
38
views
I try to make a script with a cron script [closed]
i have a script file and i have add a cron to that file but dont work
this is the script please what im doing wrong?
the script
the cron exist but dont run
1
vote
2
answers
108
views
Splunk Enterprise - Configure to drop specific events
I have a simple Splunk set-up. about 120 or so Linux servers (that are all basically appliances) w/ universal forwarder installed, and a single Linux server running Splunk Enterprise acting as the ...
0
votes
0
answers
21
views
Script run from crontab doesn't work [duplicate]
Running on the server I have a command that is started at boot as a service and it works well, now if I run the command that gives me information on the status of the service I get the data view, if I ...
27
votes
5
answers
31k
views
Crond offset five minute schedule
Is it possible to offset a cron script set to run every 5 minutes?
I have two scripts, script 1 collects some data from one database and inserts it into another, script 2 pulls out this data and a ...
0
votes
1
answer
57
views
Nginx not logging after Logrotate
I've a nginx reverse proxy with custom log files (depending on hostname)
pwd : /var/log/nginx/domain/fqdn.(log|err)
Since some time (maybe after switching to Ubuntu 23.10), my log files are very often ...
0
votes
2
answers
122
views
Email all cron stdout+stderr output only on stderr
I would like cron to only email on stderr output but when it does it should include all stdout and stderr
This is different than the usual question of only emailing on stderr (ie. redirect stdout to /...
163
votes
12
answers
333k
views
Best practices for setting a cron job for Let's Encrypt (Certbot) 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
0
answers
29
views
Cron job starts but doesn't wait to be completed [duplicate]
I've made a tool for backing up website files & DB. It works as expected if ran by any user. Usually it takes around a minute to run in my configuration. When I added it to the cron it starts but ...
63
votes
4
answers
49k
views
How to: 1 Cron Job every ODD minutes and 1 other every EVEN minutes?
I have 2 cron jobs, i want one of them to run every odd minute (1,3,5,7,9,11....57,59)
and i want the other one to run every even minute (0,2,4,6,8,10,12...58)
how can i do it in an easy way? (no ...
2
votes
3
answers
21k
views
Lots of nfs4_reclaim_open_state: Lock reclaim failed entries in syslog
I have an Ubuntu 11.10 VM set up in VMSphere. I'm storing some data on a nfs mount. The VM has been going down frequently. I haven't been able to pin the reason why down, but I think it has to do with ...
0
votes
1
answer
140
views
Debian cron Job Not Working Correctly
I am running Debian 12, and trying to use crontab to execute a Python script to retrieve some files from an Artifactory repository periodically.
I am running this job on a separate user account under ...
5
votes
1
answer
6k
views
Scheduled reboot with crontab didn't go ahead. Why might this be? [duplicate]
Information
I have the following crontab for the root user on Debian 10.
root@debian:~# crontab -l
# crontab comments curtailed for serverfault
#
# m h dom mon dow command
30 3 * * * shutdown -r ...
0
votes
2
answers
13k
views
CRON opens and closes sessions continuously
I'm seeing a huge amount of these lines in my auth logs:
Dec 31 03:45:01 xxxxxxx CRON[17259]: pam_unix(cron:session): session opened for user root by (uid=0)
Dec 31 03:45:01 xxxxxxx CRON[17259]: ...
1
vote
0
answers
44
views
crontab -> shellscript -> docker -> redirect output to localfile
I am currently switching from rsync to a borg based backup.
Everything is working, except getting the output of borg to my logfile.
My setup is as follows:
I am trying to do everything in docker to ...
0
votes
2
answers
4k
views
Centos logrotate found error, skipping
One of our servers has a access_log which is nearly 5GB in size - there is currently no log rotation so I enabled it yesterday for httpd
The contents of /etc/logrotate.d/httpd is
/var/log/*.log {
...
0
votes
1
answer
36
views
Run QEMU command with cron
I have a machine that, aside of other services, needs to run a server VM. I'm running the VM with:
qemu-system-x86_64 -nographic \
-enable-kvm \
-m 8G \
-smp 2 \
-hda gw_disk.qcow2
...
26
votes
4
answers
13k
views
OSX mojave: "crontab: tmp/tmp.X: Operation not permitted"
After updating my OSX to Mojave, it seems I am no longer able to edit my crontab. Any attempt to do so results in the error message on the title of this question.
I tracked crontab to /private/var/at ...
0
votes
3
answers
70
views
crontab -l not showing previous job
Earlier we scheduled a job in crontab and jobs are running fine. One of my teammates executed the crontab command; now previously scheduled jobs are not listing when you execute the crontab -l ...
395
votes
7
answers
974k
views
Why is my crontab not working, and how can I troubleshoot it?
This is a Canonical Question about using cron & crontab.
You have been directed here because the community is fairly sure that the answer to your question can be found below. If your question is ...
11
votes
5
answers
15k
views
Execute command when a file changes
I have a scenario where I am uploading .csv files to a specific folder, /tmp/data_upload, every day, and the old files are replaced by the new one.
I need to run a Python script once the data is ...
64
votes
7
answers
92k
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
1
answer
233
views
Scheduling job on crontab with custom timing
Can anyone help me scheduling a job on crontab that will run on 12th of each month and if 12th falls on weekends it should run on the next Monday.
I found something from Internet but it's not working
...
0
votes
1
answer
79
views
get user with crontab root
I run myscript.sh scheduled in the root crontab and I need it to detect the non-root user (with which the system starts).
I have tried these variants:
local_user=${who -m | awk '{print $1;}'}
...
0
votes
1
answer
54
views
command took very much longer to run from script than in CLI
In an AWS EC2 serverm, OS: amzn2-ami-kernel-5.10 x86_64
Trying to diagnose an issue of a slow running cron script, identified a single line of command that took more than an hour to run, everyday.
...
3
votes
3
answers
2k
views
WP-CLI doesn't run from cronjob
I made a bash script that uses WP-CLI and was intended to run from a cronjob. It runs fine from SSH, but fails when run through cron. During debugging I discovered that it was the WP-CLI part that ...
0
votes
1
answer
109
views
WP cli command not running in crontab
I've encountered and issue adding wp cli commands to my crontab.
The following works:
*/1 * * * * sudo -u web0 -i /usr/local/bin/wp theme update --all --path=/var/www/domain.com/web > /home/bob/...
15
votes
8
answers
59k
views
How to schedule a biweekly cronjob?
crontab(5) defines the following fields:
field allowed values
----- --------------
minute 0-59
hour 0-23
day of month 1-31
...
1
vote
3
answers
690
views
How to have an environment variable with quotes in crontab?
I have a minimum example of my problem, which is trying to install a crontab that looks like this:
FOO="foo\"bar\"bin"
0 0 1 * * ls
by running crontab crontab (I have it in a ...
0
votes
0
answers
99
views
On linux filesystem becoming RO, how to reliably reboot?
When the main Linux partition becomes ro for some reason (errors), I am trying to
use cron job to check and reboot (so that fsck can run and attempt a fix), but I see that even the cron may not run!
...
0
votes
0
answers
338
views
inside nginx custom docker image, cron service is running but not the jobs executing
Dockerfile of nginx container
FROM nginx:latest
# Remove sym links from nginx image
RUN rm /var/log/nginx/access.log
RUN rm /var/log/nginx/error.log
RUN apt-get update && apt-get install -y ...
0
votes
0
answers
67
views
at jobs don't clear the queue even when completed?
I have some very simple python code that sets up a job queue, piping to the linux batch command:
import subprocess
for j in range(1,17):
process = subprocess.Popen('/bin/sh', '-c', f'python test.py ...
0
votes
1
answer
47
views
changed crontab, jobs run at old AND new time now
I did a non-best practice on /etc/crontab and manually changed it to run a daily cron job at a specific time, initially for testing so I could make sure it fired off correctly.
/etc/crontab looked ...
0
votes
1
answer
95
views
btrbk not taking hourly snapshots
I have installed btrbk and I would like hourly snapshots to be taken. However, only daily snapshots are done. I wonder what goes wrong.
Pleas help me out.
Environment: OS: Ubuntu 23.04 64bit / Linux 6....
0
votes
3
answers
4k
views
curl bash script works fine in shell but not work in cronjob
I have a script using curl to do the job and set into crontabs.
Things were fine on redhat 7.5+ or CentOS 7.
But in redhat 7.2, the script turned into a junk and never output a thing from the curl ...
0
votes
2
answers
153
views
Why doesn't cron run the commands in another user's crontab?
Hello everyone and thank you in advance.
I have written a job in the mysql user crontab, but it doesn't run at all. I think my code is correct, because it works properly if I execute it pointing to a ...
0
votes
1
answer
895
views
Ubuntu 22.04 Jammy - cron seems to be ignoring timezone
I have a server configured to use the Pacific/Auckland timezone, however cron is running in UTC.
In the previous OS version this was sufficient to get everything to operate using a specified timezone (...
6
votes
3
answers
39k
views
Cron job errors with "No such file or directory" even when the file DOES actually exist?
I am getting the following three lines in an error message in /var/mail/username after the following job runs in crontab...
15 * * * * /Applications/MAMP/htdocs/iconimageryidx/includes/...
13
votes
3
answers
47k
views
Cron: Permission denied on everything
As a regular user I can't edit my cron settings.
I get a "permission denied" for everything: listing the cron commands or editing them.
Example:
cron -l
cron: can't open or create /var/run/crond.pid:...
1
vote
0
answers
87
views
gsutil fails with "OSError: Operation not permitted" when running from cron
I have a php script that does backups. The backups have been failing, because one of the first commands throws an error and stops the script. When I run the script in the terminal, it works just fine. ...
0
votes
0
answers
271
views
k8s cron job using helm chart and docker
Two Helm chart for managing db cron jobs and monitoring cron jobs separately . Which k8s components can i use ? as k8s deprecated CronJob kind from v1.25, https://kubernetes.io/docs/reference/using-...
0
votes
0
answers
126
views
Laravel Crons on Elastic Beanstalk Linux AMI 2
I am running a Laravel app on Elastic Beanstalk Linux AMI 2.
I am using the following config file in the .ebextensions folder to set up the cron.
files:
"/etc/cron.d/schedule_run":
mode: &...
0
votes
1
answer
136
views
Delaying full crontab execution per user
In a large scale multi tenant environment where user's make heavy use of minutely crons, many crons setup by users will run on the minute or on the hour causing noticeable CPU spikes at the start of ...
0
votes
2
answers
102
views
crontab shell script execution not as expected
I have a script named run_logs.sh with the contents:
#!/bin/bash
source /root/.profile
zcat /var/log/apache2/access.log.*.gz | /usr/bin/goaccess - access.log
when I run that script as root (both with ...
2
votes
2
answers
3k
views
Restart crontab @reboot rule without actual reboot
I'm using crontab with a @reboot entry which starts a script containing a endless while-loop that is processing the output of a tail -F command. Is there any way to stop the currently running script ...
7
votes
1
answer
19k
views
What is difference between */5 and 5 for minute value in crontabs?
I have cron with following definition.
*/5 * * * * /somescript
What is the difference between them? Is second one running every 5 minutes and first is running 5 minutes after every hour?
0
votes
0
answers
36
views
Add Trigger Events to a Schedule Queue in Linux
I have a MySQL table on a Ubuntu or CentOS machine which contains rows on when to start and stop a bunch of 1000 AWS / Azure servers.
Right now its implemented in such a way that a cron is running ...
0
votes
0
answers
119
views
solaris 10 cron job won't run but will run fine from command line
#!/bin/sh
#grab oldest file from queue
stuff=\`ls -1 /var/spool/lp/requests/localhost/ | /usr/bin/head -1\`
#pull printer name from lp requests (first line in file)
puff=\`cat $stuff | /usr/bin/...
106
votes
2
answers
48k
views
escaping double quotes and percent signs (%) in cron
The following command works from prompt but not from crontab.
grep abc /var/log/messages | grep "`date '+%B %d'`" | mail -s"abc log of `hostname`" s.o+`hostname`@gmail.com
I need ...
0
votes
0
answers
94
views
Cron job is wokring fine but new cron logs are not adding in cron log file
i mistakely press wq! in cron log file located /var/log/cron now new logs are not updateing in cron log file i serach many thing like
remove cron file and touch /var/log/cron Steel not updateing
...
4
votes
4
answers
1k
views
Is there a good layout convention for cron files?
I'm currently confronted with a cron file that contains a dozen different applications' tasks--some have only one, some have lots. I'm trying to figure out a good way to organize and document these ...