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
0
votes
1
answer
748
views
Using quotes in variables of a crontab job
I'm trying to get a past date inside a cron job using something like this. But the DATE variable is always empty.
DATE=date -d "$date -1 days -1 months" +%Y-%m
* * * * * /bin/echo "Date:...
1
vote
1
answer
3k
views
Ubuntu 20.04 cron jobs doesn't work when a specific time was added
I had a strange behavior in Ubuntu 20.04 cron job:
* * * * * echo "Hello world!" >> /tmp/hello.log 2>&1 <---working with logs
5 10 * * * echo "Hello world!" >&...
0
votes
0
answers
16
views
zipping in crontab does not work [duplicate]
Im trying to zip my savegames (an push them to dropbox). However, even though zipping works fine it does not seem to work when I past the command into contab.
* * * * * cd /home/steam/.config/Epic/...
-1
votes
1
answer
162
views
WP-CLI doesnt run from cronjob [duplicate]
I have a bash script which is retrieving the information from my database, based on the information it gets creates some folders containing the WP files on each one and then makes the setting. The ...
1
vote
1
answer
352
views
When I execute a script in crontab the output is in a different language
I am executing a script in a crontab that writes a log, when I run it as root, the log is written in spanish.
But when I run it in the crontab, the output is in english.
Is there a way to run the ...
1
vote
0
answers
1k
views
Crontab not running @reboot
I have ubuntu server with crontab that is supposed to run mkdocs in tmux at reboot.
Worth noting is that I configure crontab by going into crontab -e.
Line is:
@reboot /usr/bin/tmux new-session -d -s &...
1
vote
1
answer
1k
views
cron/php how to run command as a non root user
I need to run command (only one command) as a non root user from cron.
Have tried two versions and both fails;
Cron:
* * * * * php script.php
script.php:
exec("whoami"); // returns 'root'
//...
2
votes
2
answers
3k
views
How can I crontably reboot a Linux host upon network failure? [closed]
I have a personal Ubuntu host, connected to a public/sharing Wi-Fi AP (not under my control).
Sometimes, it would have a network issue, and I am very sure, only restarting the network service would ...
1
vote
1
answer
67
views
Cron job does not start at hh:10
*/10 * * * *
This should run the job (PHP script) every 10 minutes, but it does not ran at hh:10... The PHP script writing data to a MySQL database which should be done every 10 minutes
e.g.
2021-12-...
1
vote
1
answer
367
views
How can I make my cronjob friendly to reboot and other interruptions?
I have as part of my cronjob a variable random delay. This has good reasons to exist, it's to distribute the load of the automated process from spiking on various minute or hour boundaries.
I suspect (...
0
votes
1
answer
409
views
How Do I Get Crontab to Run a Whole Directory of PHP Files?
I've created a little program that will generate php files and place them into a '/crons' folder to allow cron jobs to execute the files. These php files will be generated and named dynamically based ...
0
votes
0
answers
399
views
How do you debug a cronjob that's not working?
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$_SERVER['SERVER_SOFTWARE'] = 'Apache';
$_SERVER['HTTP_USER_AGENT'] = 'PHP';
$_SERVER['PHP_SELF'] = '/wp/wp-...
2
votes
5
answers
11k
views
Start cron job from 06:05 until 22:05 for every 15 minutes
I need to run a cron job every 15 minutes starting at 06:05 and ending at 22:05.
0 5/15 6-22 * * *
The following syntax includes 22:35 and 22:50.
Any idea how to achieve this? Is this possible with ...
0
votes
2
answers
457
views
How to disable crontab list entries in cron log?
I have a script on server that runs every few min, and among other things checks if some malicious crontab entries have been injected. In order to do this I check crontabs of all users, which works ...
0
votes
1
answer
244
views
How to use a screen with bash script? [duplicate]
I tried to create an executable .sh file with command that create screen like this:
screen -dmS ast [comand]
And let my crontab execute it like this
* * * * * bash /root/my_bash.sh
But nothing ...
0
votes
1
answer
1k
views
Crontab - day of month seems to override day of week?
I have five servers running an eventstore cluster. I want to run a crontab command on each one on separate days.
Run on Monday
Run on Tuesday
etc
But I also want to run a different command on the ...
0
votes
1
answer
2k
views
CRON[83463]: Failure setting user credentials
I have a number of docker containers, all set up mostly identically, which successfully use cron to run nightly backup jobs.
I have another container, set up mostly identically, which tries, and fails,...
0
votes
3
answers
2k
views
How to run Python venv script with screen in crontab
I have a sh script with the following content:
screen -mdS myscript /home/myscript/myscript_env/bin/python3 /home/myscript/bot.py
This script executes a python script and opens it in a new screen.
It ...
0
votes
1
answer
807
views
script backups sqlite database, when ran as a cron the db and names are mangled
I have a crontab:
* * * * * /home/ipa/web/backup.sh > /dev/null 2>&1
(No it doesn't run every minute just testing here)
The backup.sh has this:
#!/usr/bin/env sh
sqlite3 /home/ipa/web/...
0
votes
1
answer
602
views
Cronjob Files Not Closing and 100% CPU usage
I'm running a php file every 10 seconds with a cronjob. While the system was running fine, I noticed last night that php was using 100% of the CPU and crashing the system.
When I checked with ps aux, ...
0
votes
1
answer
528
views
Issue with WP Cron does not appear to be working correctly - Wordpress
The wordpress site has been showing the message "Problem with WP Cron does not appear to be working correctly". We have tried a lot of things, but nothing.
This problem appeared from nowhere....
0
votes
1
answer
496
views
EC2 server with a crond-service and full /var/spool/exim/-folder
I'm no expert in linux, apache, etc. but I have this service running on an AWS EC2-server. There is a large number of cron-jobs running on my platform (about 50K / day).
Last week upgraded the EC2-...
0
votes
1
answer
124
views
Send keys over ssh connection to nano editor
I have a situation where I am deleting the crontab and then recreate it.
So I do crontab -r and then crontab -e.
The problem I have is that crontab -e opens up nano, and I'd like a command line that ...
0
votes
2
answers
1k
views
No such file or directory in sh file running
It may be duplicate because there is some similar question but I am not able to fix it, that's why I ask again with my code.
My sh have these code:
cd /home/domain.com/data/domain-statistics
git fetch ...
0
votes
0
answers
113
views
/etc/cron.daily/ what this command is doing?
Could you help to explain what this command is doing?
printf '#!/bin/sh\n\find /opt/traccar/logs -mtime +5 -type f -delete\n' > /etc/cron.daily/traccar-clear-logs && chmod +x /etc/cron....
5
votes
1
answer
2k
views
Will certbot actually renew my certificate?
Looking at /etc/cron.d/certbot, I don't think it will! That file includes the line:
0 */12 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system && perl -e 'sleep int(rand(43200))' ...
0
votes
1
answer
390
views
crontab: using ${USER}
I am writing some scripts that uses ${USER} to point to subsequent scripts. But when I run it from crontab, it errors out and the files are not found. I understand why.
I intend to share this with my ...
0
votes
1
answer
936
views
visudo says that there is a syntax error
I am using centos 8.So, my intent is to make the user manager to be able to run this command without the need to use sudo.
manager ALL=NOPASSWD: tar -czf /root/assignment/result/student-submissions-$(...
1
vote
1
answer
105
views
Crontab - How to verify a PHP script Runs Successfully or not in a Cronjob Shell Script?
I have below crontab in the system (Centos 7.9), However i am unable to verify if this runs correctly or not,
i.e if the crontab finds the PHP enr. variables or if the crontab has executed correctly ...
5
votes
2
answers
28k
views
What is the meaning of the "/dev/null 2>&1" in a Cronjob entry?
Can someone explain to me what is the meaning of "2>&1" doing here in the below cron job
0 23 * * * wget -q -O /dev/null "https://example.com/index.php" > /dev/null 2>&...
0
votes
2
answers
1k
views
Cron Tab as specific user and python virtual env
Wanting to run an hourly cron job as a specific user (xfeautomation) and python virtual environment. Running as a specific user, will I have to add the script location into PATH?
My current cron job ...
1
vote
1
answer
2k
views
docker postgres backup creates an empty file when run as a cron job
I'm trying to create a cronjob that creates db backups every night.
My crontab has the job:
* * * * * /home/user/scripts/backup.sh (have it set to go off every min for testing)
In backup.sh, I have:
...
0
votes
1
answer
288
views
Google Jobs: Quota exceeded for the number of App Engine Cron jobs
Yesterday at 8:00 am, I had a quota of 250 app-engine jobs.
At 9:00 am, I deployed a yaml file with 280 jobs, I got this error:
"error": {
"code": 429,
"message": "...
0
votes
1
answer
801
views
Can't get cron to open Jar file
I'm running a minecraft server on ubuntu 20.04. I have a script to execute it and works fine.
However i can't get it to work @reboot with cron, because it can't find the jar file. From what i ...
1
vote
1
answer
948
views
Cron: MAILTO for all cronjob notifications to an external address uses the wrong `to` header
My goal is to send everything that gets output from the cron daemon (no matter which crontab) to an external email address with the correct TO email header.
I set MAILTO in /etc/default/cron to MAILTO=...
1
vote
1
answer
172
views
Uniform Server cron not executing php script
I'm running Uniform Server Zero XIV and am trying to use the cron to run a php script every 15 minutes. When ran manually, the script does what it is supposed to, which is updating values in a ...
0
votes
1
answer
247
views
Dump an external database in Kubernetes
I have created a Kubernetes CronJob (in AKS) to run a database dump (the database is not located inside the Kubernetes cluster). This CronJob create a Job each day which will dump the database in a ...
1
vote
0
answers
39
views
Cron Help in Amazon Linux 2 EC2 [duplicate]
It's like not only Amazon Linux 2 I could not setup cron. I type
crontab -e
then
@reboot bash /home/ec2-user/abcd.sh
After Rebooting the EC2, this cron job doesn't work. The same used to work in my ...
2
votes
1
answer
2k
views
How do I properly use flock(2) with a cron script?
I am using a crontab to execute a php script that retrieves data and writes it to a database. My crontab entry looks like:
* * * * * php /path/to/file/fileName1.php
* * * * * php /path/to/file/...
0
votes
2
answers
980
views
Cron Job to move files not running
I added this command in my crontab, but it's not working. I saved in both my user and root crontab but neither is working.
* * * * * [ $(ls -al /media/cyper/evo_1tb | grep plot | wc -l) -gt 0 ] &&...
0
votes
1
answer
2k
views
Why are cron jobs not being logged by rsyslog on Debian 10 buster?
(I figured this out, it was multiple problems...I'm leaving this as is and explain the process I took to resolve in my answer to this question)
I'm working on a simple Ruby script that runs as a cron ...
1
vote
1
answer
37
views
Bash-Skript (Cronjob): Programm öffnen hat falsche Sprache
Which ENV must be exported that a bash cronjob script opens the program in the correct language?
If I open the bash script so manually in the command-line the program is opened in the correct language....
0
votes
2
answers
133
views
Bash-script: run another script on bottom as an other user
I have a bash script that runs over crontab as root.
On the bottom of that script I want to run another bash script as another user in a subshell (detached).
How can I do that
The normal command would ...
0
votes
0
answers
155
views
crond not loading /etc/pam.d/crond config
I have this PAM config in /etc/pam.d/crond:
auth required pam_env.so user_readenv=1
And this .pam_environment file:
_APP_PASSWORD DEFAULT=foo
And this test cronjob:
*/1 * * * * root env 2&>1 |...
0
votes
1
answer
31
views
Prevent failed / interrupted cronjob from retrying
I have a cronjob (on a CentOS server) which looks like this:
20 3 * * * wget -qO- "http://example.com/mycronfile.php?parama=1¶mb=2¶mc=3" > /dev/null 2>&1
The PHP ...
0
votes
0
answers
28
views
Alock is not launched when specified in crontab
I have the following problem: I am going to run a TV dashboard basing on Ubuntu 20.04 LTS focal with transparent screensaver and with locking feature enabled. In my configuration, I used activated ...
0
votes
1
answer
1k
views
Cron job to create and send backups over FTP
My VPS is running on Centos 7 with nginx and MySQL 8.0
I have created 2 cron jobs to backup my files and database everyday at a specific time.
everything works fine but I'm trying to send those backup ...
0
votes
1
answer
477
views
While a process is running manually, it stops after a while in the cron job [duplicate]
I have a PHP script and this script loops thousands of lines. When I run the PHP file manually, this loop of thousands of lines returns successfully. But when a cron job does this, it turns around 143 ...
0
votes
0
answers
297
views
Cronjob execution based on different timezone (Ubuntu 18.04)
OS: Ubuntu 18.04
Cron: cron/bionic,now 3.0pl1-128.1ubuntu1 amd64
System timezone is: America/Los_Angeles (PST)
I want to set timezone of an EXECUTION TIME (not the timezone for the script) for ...
1
vote
2
answers
4k
views
cron is not restarting pm2 [duplicate]
I've tried many things but cron just won't restart pm2.
I set the crontab -e with:
SHELL=/bin/sh PATH=/bin:/sbin:/usr/bin:/usr/sbin
*/10 * * * * /usr/bin/node /usr/bin/pm2 restart all
And the I ...