Questions tagged as ['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.
Score: 0
DenisZ avatar
How to disable crontab list entries in cron log?
do flag

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 all good, but my /var/log/cron file gets filled up with entries of the all crontab listings, so everytime I run the script it would log all crontab lists like this:

Nov 30 17:16:02 myserv crontab[348610]: (roo ...
Score: 0
How to use a screen with bash script?
ng flag

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/

But nothing executed, but with normal console command bash /root/ it's working successfully.

How can I fix it?

Score: 0
Simon Avery avatar
Crontab - day of month seems to override day of week?
sa flag

I have five servers running an eventstore cluster. I want to run a crontab command on each one on separate days.

  1. Run on Monday
  2. Run on Tuesday etc

But I also want to run a different command on the fourth week of every month.

I set them up like this, thinking it should work - and checking confirmed what I thought should happen;

Machines 1-5:

  1. 30 6 1-21 * Mon /first-command-to-run
  2. 30 6 1-21 * ...
Score: 0
CRON[83463]: Failure setting user credentials
us flag

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, to use cron to run a nightly backup job.

I installed rsyslog to get more information, and when cron runs root's crontab I see the following entry in the syslog file:

CRON[83463]: Failure setting user crede ...
Score: 0
How to run Python venv script with screen in crontab
jp flag

I have a sh script with the following content:

screen -mdS myscript /home/myscript/myscript_env/bin/python3 /home/myscript/

This script executes a python script and opens it in a new screen.

It works fine when executing the sh file in the terminal, however when using a crontab to execute this sh script at reboot, it does not work:

@reboot ./home/myscript/
Score: 0
script backups sqlite database, when ran as a cron the db and names are mangled
in flag

I have a crontab:

 * * * * * /home/ipa/web/ > /dev/null 2>&1

(No it doesn't run every minute just testing here)

The has this:

#!/usr/bin/env sh

sqlite3 /home/ipa/web/ipa_django/mysite/db.sqlite3 ".backup 'backup_file.sqlite3'"
let seconds=$(date +%H)*3600+$(date +%M)*60+$(date +%S)
echo $seconds
echo $filen ...
Score: 0
Burak.H avatar
Cronjob Files Not Closing and 100% CPU usage
et flag

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, I saw that my cron file had dozens of cron files in process. There wasn't even a reason for that when I checked the database. So my php page was supposed to return empty and finish instantly.

I have a  ...

Score: 0
ansible-playbook: command not found when running bash with cron
cn flag

Running on ubuntu18, have a bash job to collect data from a router using ansible. Here is the bash script

cd ~/datacollect
ansible-playbook -i /home/user/datacollect/hosts /home/user/datacollect/datacollect.yml

If I run the bash job from ubuntu console, there is no issue. Since we need to collect data every 5 minutes, I created a cron job for it.

* * * * *  /home/user/datacollect/call ...
Score: 0
0diseus avatar
Issue with WP Cron does not appear to be working correctly - Wordpress
cn flag

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.

We have disabled possible cron jobs that would interfere with wordpress, we have tried erasing 'cron' from the database... but nothing

Score: 0
Simon Degn avatar
EC2 server with a crond-service and full /var/spool/exim/-folder
ug flag

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-instance and then I started the cron-service on the new instance. Since then, the cron-jobs are leaving a massive amount of output-files in the /var/spool/exim/input-folder. They are all named something ...

Score: 0
IonutN avatar
Send keys over ssh connection to nano editor
ru flag

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 can do crontab -e then send the F3 and F2 keys, which are for save and exit.

I need to this happen since I will be sending the commands via an ssh connection so nano will not be used interactively.

I am doi ...

Score: 0
No such file or directory in sh file running
in flag

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/
git fetch origin
git merge origin/master
git add --all
git add .
git commit -am "File generated and updated on `date`"
git push origin master

when i run it as:

-bash-4.2$ sh /home/ ...
Score: 0
/etc/cron.daily/ what this command is doing?
hu flag

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.daily/traccar-clear-logs
Score: 4
IpsRich avatar
Will certbot actually renew my certificate?
id flag

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))' && certbot -q renew

and, unless I'm reading it wrong, renewal will only happen if there's a readable, executable file called /usr/bin/certbot (there is) AND if there's not a directory called

Score: 0
crontab: using ${USER}
cn flag

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 colleagues and each time the colleague has to manually change the first line to his own username. How can I minimize this issue (not have a manual way to change that one line)?

Score: 0
Newlinux-men avatar
I am getting anacron error alert "0 processes running with arguments: "/usr/sbin/anacron -s"
lc flag

I am getting an alert from a linux server and alert is "0 processes running with arguments: "/usr/sbin/anacron -s", with command: "anacron", as regex" . What could be the reason of this and what could be the possible diagnose steps and solution

I can see crond is running and anacron is installed .

out put of >> # journalctl | grep anacron

Aug 19 03:51:02 anacron[16012]: Job `cron.daily' terminate ...

Score: 0
How does systemd ensure to run cron.daily for desktops/laptops that occasionally are powered off?
ar flag

How does systemd ensure to run cron.daily for desktops/laptops that occasionally are powered off?

In the past I relied on anacron, it took care of my /etc/crod.daily.

UPDATE I see but I'm not sure if it is official systemd project.

Score: 0
clemmy17 avatar
visudo says that there is a syntax error
fr flag

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-$(date +\%Y-\%m-\%d).tar.gz /root/assignment/report/main/

Here is the output:

/etc/sudoers: syntax error near line 122

line 122 is the 1st line in the above code.

Score: 1
mahen3d avatar
Crontab - How to verify a PHP script Runs Successfully or not in a Cronjob Shell Script?
cn flag

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 without any errors in the shell or if the crontab entry has syntax issue ..etc

Any suggestion on how to do debug or capturing the output of a crontab like this one below

0 */1 * * * /var/www/ ...
Score: 3
mahen3d avatar
What is the meaning of the "/dev/null 2>&1" in a Cronjob entry?
cn flag

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 "" > /dev/null 2>&1
Score: 0
Brandon Pham avatar
Cron Tab as specific user and python virtual env
us flag

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 looks like this:

0 * * * *  xfeautomation /opt/scripts/wf_venv/bin/python /opt/scripts/ 2>&l /opt/scripts/log.txt

Is this the correct or optimal way? TIA

Score: 1
Ethan Solomon avatar
docker postgres backup creates an empty file when run as a cron job
in flag

I'm trying to create a cronjob that creates db backups every night.

My crontab has the job: * * * * * /home/user/scripts/ (have it set to go off every min for testing)

In, I have:

docker exec -it dbContainer pg_dump -U username -d dbName > /home/user/backups/testingBackup.sql

The file is always empty:

-rw-rw-r--  1 user user    0 Jul 14 08:39 testingBackup.sql

However, if I run th ...

Score: 0
Ntakwetet avatar
`vbetool dpms off` not working from crontab
in flag

I have an old laptop I'm using to host a home Debian server. I'd like to switch the screen off at boot, so I put

@reboot vbetool dpms off

in the root crontab (sudo crontab -e). It looks like it runs as expected (see troubleshooting below) but the screen doesn't switch off. Also, when I run vbetool dpms off from SSH it works as expected.

Do anyone have any suggestion?

Troubleshooting results follo ...

Score: 0
Yoan avatar
Google Jobs: Quota exceeded for the number of App Engine Cron jobs
cn flag

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": "Quota exceeded for the number of App Engine Cron jobs.",

=> fair enough

At 9:40 am, I asked GCP to increase the quotas of app-engine jobs to 500.

At 4 pm, the quota was increased => very good.(I can see i ...

Score: 0
eggzaile avatar
Can't get cron to open Jar file
ar flag

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 researched, it seems cron doesn't run with my user (although i'm not using sudo). What are my options?

This is my crontab -e:


00 01 * * * /home/ ...
Score: 0
beard black avatar
i get email notifiy from rkhunter : ": No such file or directory"
ru flag

I running ubuntu headless server 18.04 LTS and have set up mail notification for the rkhunter application and I get this message every day:


Cron <> test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )


grep: /etc/init.d/ystemctl: No such file or directory
grep: list-dependencies: No such file or  ...
Score: 0
manifestor avatar
Cron: MAILTO for all cronjob notifications to an external address uses the wrong `to` header
mp flag

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=root and set /etc/postfix/virtual to root external@email.address. This setup works, output from each crontab is delivered to external@email.address, but the annoying thing is that, the TO email header doe ...

Score: 1
jcnoe avatar
Uniform Server cron not executing php script
cn flag

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 database. However, the cron never seems to actually execute the script.

The cron log is indicating that the crontab has the correct path and is executing.

10/06/2021 12:53:08  - Run OK --- C:\Users\myuser\Zero\U ...