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
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 ...
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
1
answer
58
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 /...
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 ...
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 ...
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
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
...
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 ...
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.
...
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/...
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
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 ...
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
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
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 (...
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 ...
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/...
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
...
1
vote
1
answer
474
views
/etc/cron.d not running job [duplicate]
I need to run a script as a user to backup my database every night. I added the following cron job in /etc/cron.d/backup-mysql via ansible.
0 3 * * * backup_mysql /path/backup-mysql.sh
I can see the ...
0
votes
2
answers
6k
views
How to run a python script in a specific directory automatically?
I have a python script that I wish to run at 5pm every Friday.
How can I achieve that ?
I understand I could do this through cron. However, as I have used relative file paths in the Python script and ...
0
votes
1
answer
794
views
crontab job output not generating email
I have been running many cron jobs (on various operating systems, CentOS, for example) that normally run with no output. I usually keep an eye on my jobs by checking my email. I use the fact that ...
1
vote
1
answer
74
views
Cron executes while partly ignoring trigger
There's a problem with my crontab
I set
*/5 * * * * /home/money/relaunch.sh
in crontab -e
in relaunch.sh is
#!/bin/bash
/usr/bin/pgrep -l -x xyz || /home/money/a.sh && /home/money/xyz.sh
...
1
vote
1
answer
150
views
CentOS scheduled OOH restart of service
I would like to schedule a one-off OOH restart of a service using cron.
Can I just add something like:
/usr/sbin/service myservicenamehere restart
... in the crontab, to run once?
1
vote
1
answer
417
views
Redirecting stdout and stderr doesn't work with cron
I have the following cron task. Expected behavior is that every output (standard output and standard error output) of this task will be redirected to /dev/null. Unfortunately this doesn't work. Emails ...
0
votes
0
answers
54
views
Change default cron log location
I have apache server with $HOME is var/www/, I create a cron job and all logs get into that directory, how to change it to another folder? Is there any config file on apache to change that? Btw, I'm ...
0
votes
0
answers
110
views
why almalinux is hanging over night with auditlog
hey there is a hosting server
overnight my server hanged up and must to restart it in morning to get it back online and saw this error in my console (you can see the picture)
please help me
https://...
0
votes
0
answers
833
views
logrotate works manually but not works automatically via cron on Ubuntu 18.04
I have a logrotate task to rotate my nginx logs. I have my config file in /etc/logrotate.d/nginx. When I run logrotate -f /etc/logrotate.d/nginx, it can rotate the logs correctly, which means my ...
0
votes
1
answer
128
views
Error when I execute crontab in linux
I'm executing a crontab where it call the script of python and the crontab are executing very well, but when I execute the crontab I need its will create other file in another directory, but that ...
0
votes
0
answers
420
views
cron / crontab : auto delete oldest backup files when new files get backed up, only if disk space is near capacity
I am using crontab (on Ubuntu Server 20.04) to automatically create daily backups of a text file and storing them on an external hard drive. I am using the following crontab to create my backups:
@...
0
votes
1
answer
126
views
crontab job did not start on CentOS7 [duplicate]
here is the crontab for root on my CentOS7 :
# crontab -l
# Lines below here are managed by Salt, do not edit
# SALT_CRON_IDENTIFIER:CLEANCORE
0 * * * * /var/lib/scality/cleancore/clean_core.bash --...
0
votes
0
answers
45
views
Crontab I have tried cronitor airplane nothing helps
my crontabs do not run, sys log gives me this, Jan 6 08:30:02 joe-sbc-flt1 CRON[102851]: (joe) CMD (/home/joe/scripts/watchit.sh) I have no idea what it means or what is wrong, can anyone help?
0
votes
1
answer
474
views
Cron Jobs don't run all the time (just a part of the hour)
I work on a website who is using cron jobs for import and update products. The platform is Woocommerce.
The supplier offered the csv file, and a server requirements. I have them over the requested: ...
2
votes
1
answer
901
views
What is the best directory to place your cron jobs?
We have a machine that executes cron jobs. We'd like to upload (via scp) cron job files to. Here is an example of a cron job file (test.cron):
* * * * * echo "test" > /tmp/test_cron
This ...
0
votes
1
answer
1k
views
Cronjob "No space left on device" when logging error but there is space [duplicate]
I am trying to troubleshoot some cronjob problems I am having so I wanted to start logging them.
* * * * * wget https://www.example.com/dosomething.php >> /var/log/myjob.log 2>&1
When I ...
0
votes
1
answer
131
views
is my crontab syntax invalid?
simple question:
10 4 * * * rm -rf ~/code/rehlds/build/ && ~/code/rehlds/build.sh --compiler=gcc --jobs=4 > /dev/null 2>&1
I checked an there is no /build folder which indicates ...
0
votes
2
answers
309
views
How to make timeout(1) behave in cron like it behaves in interactive shell
Running this command in an interactive bash:
$ timeout 1 sleep 2; echo $?
124
returns 124 after 1 second, as expected and as documented in timeout(1).
However, if I run the same as a cron job, or if ...
-1
votes
2
answers
184
views
mailx Set Name of Attached File
I have a cron job, whose output I send to mailx:
# Monday morning at midnight; "mail" is symlink to "mailx"
00 00 * * mon python3 script-with-7500line-output.py | mailx -S 'from=...
0
votes
3
answers
254
views
Crontab not working as expected [duplicate]
Dears,
i configured script in crontab to run every 10 minutes and its not working at all. I dont see any entry in configured log path (/var/log/cron)
"*/10 * * * * example_script.sh"
...