Questions tagged [cron]
cron is a task scheduler based on clock time that runs on Linux-based machines.
912
questions
0
votes
1
answer
2k
views
Running a Python script in the background on macOS Big Sur
I'd like to use a cron job to run a task which involves a python script.
The bash script for the task looks about like:
#!/bin/bash
...
python ./script.py &
...
Which is called via crontab like:
...
3
votes
1
answer
405
views
certbot-auto fails to install automatic renewal?
I am using kernel 3.10 on CentOS 7. I have successfully installed CertBot 1.10.1 using alternative installation instructions as certbot-auto. Running certbot-auto successfully generated certificates ...
1
vote
0
answers
144
views
Lynx-dump cron job not working after installing SSL certificate
I have a cron job that has always worked fine, until we installed an SSL certicate and updated our .htaccess file to redirect all http requests to https. Now, the cron job is not working and I'm ...
0
votes
0
answers
88
views
Can't install anything on my router shell
I know this might be a noob question or maybe not. I have an ssh shell with my router and I want to make a cronjob for the router to update the IP address of a DDNS provider(Dynu.com). I tried the ...
2
votes
1
answer
5k
views
How to create a persistent cronjob on an Ubiquiti Edgerouter-X so its still there after a firmware update
We have tens of Ubiquiti Edgerouter-X's on active on customer locations. They among other things responsible for pinging an IP each minute. This is done by a cronjob (set with crontab -e) and works ...
1
vote
0
answers
109
views
Cron a database dump on an external SFTP server
I have a command to dump a database in a local server, and want a daily backup of that database in an external SFTP location.
I checked out the scp command and it works smoothly, now I need (maybe ...
0
votes
1
answer
258
views
Moreutils' Chronic reports everything in STDOUT, but only when run in cron
I prepared the following script to test chronic & cron:
echo "normal out"
echo "error out" >&2
exit 0
When I run it on normal shell with chronic -ev, output is as ...
2
votes
0
answers
113
views
why does this anacron job run hourly, not daily? [duplicate]
I'm running zulip on a virtual private server, and have created a script backup-zulip on my laptop (with ubuntu 20.04) to back up zulip via ssh. I want to run this script daily, so I put the line
@...
2
votes
3
answers
3k
views
Logrotate running at wrong hour/time
I have the following entry in my /etc/crontab file to ensure that daily cronjobs run at 4:25 AM. This is the only entry for daily inside this file:
25 4 * * * root test -x /usr/sbin/anacron || ...
0
votes
1
answer
567
views
Cron job fails to run NodeJS script
I have a cron job for which I want to log output. The cron file (crontab -e) is:
0 7 * * * node $HOME/server/task.js >> $HOME/server/log.txt
The cron task is called:
$ grep CRON /var/log/syslog
...
1
vote
1
answer
835
views
PHP cron job — that worked before — suddenly stopped working when Plesk scheduled tasks
I am creating the cronjob from my Plesk control panel.
The cron is like so:
0 0,3,6,9,12,15,18,21 * * * /usr/bin/php httpdocs/sources/australia.php >> /var/www/vhosts/website-here/logs/topfbk....
0
votes
1
answer
310
views
S3 command not working in cron
I have this ultra simple cron job:
48 20 * * * cd /home/pankaj;s3cmd -f get s3://myfile.gz
The command works by itself. But the cron job does not. The cron job
is created for the same user(pankaj) ...
0
votes
1
answer
390
views
Logrotate status file update from different crone jobs
I have several scripts in /etc/logrotate.d/ all are included in /etc/logrotate.conf and crone job that runs:
/usr/sbin/logrotate -s /var/lib/logrotate/logrotate.status /etc/logrotate.conf
daily. But I ...
1
vote
0
answers
2k
views
Why can't I execute shell script via crontab?
I have this script shell1.sh ubicate in /home/documents/files, the script is for the creation of users on Linux, so it asks for some information and later creates the user.
I want it to run for every ...
0
votes
1
answer
387
views
System crontab won't run for certain user on Centos 7
I have a super simple system crontab to run as a specific user. For a user that can login to a Gnome session it works fine. For another user that I use just for system tasks, it will not run.
This is ...
1
vote
1
answer
731
views
Does CRON execute scripts similarly to
Does CRON execute scripts similarly to how a user is using an open session and sitting at the terminal for scripts that require such execution.
OR
Does CRON require the use of tmux and screen?
0
votes
2
answers
596
views
Crontab entry is not working
I want a set of files copied daily from a remote server to local machine at 5 am in the morning. The following crontab entry does not work:
0 5 * * * scp [email protected]:/tmp/bkp*tar.gz /home/...
1
vote
0
answers
78
views
Cron job - every minute between 8:30 and 9:00
I want to run a script 8:30 to 4 each day.
Currently I have this to handle the 9 to 4.
*/1 9-15 ? * MON-FRI *
I think I discovered that the 15 is inclusive, so this will run up to 15:59
Can some ...
2
votes
0
answers
139
views
How do I stop SpamAssassin cron job from mailing me errors?
I have a cron job for SpamAssassin to update, but it keeps sending me the errors. How can I stop the SpamAssasin job from emailing me?
This is the email that I get:
Subject: Cron <root@kizbit> /...
0
votes
1
answer
983
views
How do I edit the crontab for SpamAssassin updates on CentOS 6?
I receive this email daily:
From: Cron Daemon
Subject: Cron <root@server> /usr/share/spamassassin/sa-update.cron 2>&1 | tee -a /var/log/sa-update.log
UTF-16 surrogate 0xd800 at /usr/...
0
votes
1
answer
135
views
How can I configure a Linux backup server such that the hard drives, including the system drive, are powered off when not in use?
I'm currently working on setting up a backup server for my NAS. This server is to take an incremental backup of my NAS every 24 hours, which should only take a few minutes. Yet, I want 24/7 remote ...
1
vote
2
answers
823
views
Init.d / crontab does not execute code on system start Ubuntu 20.04 Unix
As Unix Ubuntu does not support a natural scrolling and tap touchpad click I created simple script for enabling those options. As I got tired of executing it every time I reboot the laptop I wanted to ...
1
vote
1
answer
696
views
How would I make a cron job stop and start again?
I am trying to make a cron job that stops at 12am today(friday) then start again Monday at 7am, what would the script for this look like, I am new to cron jobs.
0
votes
1
answer
355
views
Spotify cache now at 11gb, how to delete with Crontab?
I am aware that Spotify downloads songs and keeps them on my hard disk rather than keep re-streaming them. However, my Spotify cache is now up to 11gb and I’d like to use crontab to delete it.
I ...
3
votes
1
answer
982
views
Looks like cron spawns a shell which in turn spawns a script; how can I get rid of the intermediate shell?
The OS is CentOS 7.
I have a rather basic understanding of crontab and crond. I created a crontab entry using crontab -e:
*/5 * * * * /root/script.sh > /dev/null 2>&1
The script detects if ...
0
votes
1
answer
574
views
Cron job doesn't work
I have a shell script which I want to run as a cron-job every 10 minutes. I'm adding the job as follows
crontab -e
*/10 * * * * /bin/sh /home/tool/fill_data/run_script.sh
And the run_script.sh ...
1
vote
2
answers
642
views
Cronjob stuck in a reboot loop
I have added a rather simple cronjob to my machine to perform a daily reboot at a given time (in this example 06:30)
30 6 * * * reboot
I may be misunderstanding something completely here, but the ...
2
votes
1
answer
6k
views
How to log the output from an rsync backup which runs from a script using crontab?
I would like to log all the output that is generated by rsync; the output that I see when I run the script myself in terminal. I would prefer this logging to occur from within my script.
Here is my ...
2
votes
1
answer
877
views
Send email once per day using pm2 and nodemailer
We are using a Ubuntu 18.04 server with pm2 to schedule the launch of a node.js backend on startup and have a working nodemailer script that sends an email to our team members with the state of some ...
1
vote
3
answers
963
views
Disable warning from mdadm for “degraded” RAID1 with missing drive
I recently had a server outage due to a failed drive. Because of that I set up the server with a new SSD in RAID1 this time but until I managed to get another SSD drive the mdadm-based RAID1 runs with ...
1
vote
1
answer
1k
views
Cron scheduled backup script not working or writing to log file
I have a duplicity backup script set to run once per day through the root cron tab.
I set it up like this:
sudo crontab -e -u root
and added the line:
00 03 * * * root /home/[myusername]/...
0
votes
1
answer
2k
views
script works via command line but not in cron job
Not sure what I am doing wrong, I tried running this cron job where it should run this script (test.sh) where it copies my photos from one folder to a tmp folder but the cron job does not work unless ...
0
votes
1
answer
845
views
How can I debug when a cron job isn't executed in a certain docker container?
What I have done is:
docker run --rm -it SomeCentOsBasedImage
(in a docker container)
yum update -y
yum install -y vim cronie python3
vim /script.sh
#!/bin/bash
echo "a" &...
2
votes
1
answer
3k
views
How to test cron @reboot entry?
How can I test if @reboot is working without the need of reboot the machine?
Is there anyway to force @reboot to entry to run?
Thank you.
0
votes
0
answers
51
views
Cron does not store logs into specified file, does not execute either
I have the following cron job which fails to execute. No logs are being stored, neither printed in the shell. What can be the issue?
(ubuntu) CMD (cd path\to\script && /usr/bin/python3.8 ...
0
votes
1
answer
167
views
Cron jobs do not execute
I have 3 python scripts which are scheduled in the same crontab as :
# Script 1
0 0,6,12,18 * * * cd path/to/script && /usr/bin/python3.8 -W ignore script1.py >> file1.out
# Script 2
0 ...
0
votes
1
answer
116
views
./jmap command works when script is run manually but fails when run as cronjob
I have a fairly simple script written for calculating heap size and it uses ./jmap.
The script first finds the process id and saves it in a variable PID. The same PID is given as a variable in the ...
0
votes
1
answer
414
views
pacmd command run in local crontab does not work
I am trying to run certain commands at startup to allow my Audio to be FIFO Piped into a file.
If i run the commands (either manually or in a script) it works fine. However when i put them in my local ...
0
votes
0
answers
886
views
Terminal with a command line switch --minimized (or --min etc.)
I am trying tu run terminal commands so a terminal window is shown only in a task bar or even not shown at all. There are some approaches of it with xdotool or wmctrl but they work so the window ...
1
vote
0
answers
150
views
Reattaching a screen in a crontab to wait until the screen closes returns "Must be connected to a terminal."
I use a bash script to backup a minecraft world, which is called from a crontab every day. Though the backups are made just fine, I've found an error message in the output:
Must be connected to a ...
1
vote
0
answers
1k
views
Start tcpdump with script on system start
I'm trying to run a script on startup that runs the tcpdump command on Centos 7 and Centos 6.
The aim is to start a rolling pcap when the system starts.
I've tried using a cron with @reboot, but it ...
3
votes
1
answer
1k
views
Cron job creating output file, but not running Python script
I have the following entry in crontab -e, which is supposed to run a python script every day at 11 am and dump the output to log.txt:
0 11 * * * /usr/bin/python3 /var/www/folder/python/script.py > ...
1
vote
0
answers
52
views
Define environment variables for cronjob
I have a user cronjob which loads environment variables from ~/.bashrc using "source" command.
The variables are defined there like:
export FOO="bar"
However the variables do no appear in the ...
0
votes
0
answers
109
views
Send files created in last minute with sftp one line?
I would like to SFTP files with a .json only files created in the last minute.
For context: the machine I'm using has no internet connection, so I cannot install additional packages through yum, the ...
2
votes
1
answer
404
views
efficiently check whether remote tracking branch changed (git or gitlab)
I'm looking for the fastest way of finding out, whether a remote tracking branch is different from a current branch.
Context:
Id' like to run a cron job, that shall find out, whether the current HEAD ...
0
votes
1
answer
144
views
website backup via cron job and "file changed as we read it" issue
I'm creating scheduled backups of a website (i.e. its "public_html" folder) via cron job and the first action is to compress that folder into a tar.gz backup ("public_html_date.tar.gz").
Sometimes I ...
2
votes
1
answer
1k
views
cron and flock with change directory command
I have the following cronjob specified and it is working as intended, except that sometimes it runs duplicate jobs which should not happen. I.e. the first one would have to be terminated first.
...
0
votes
1
answer
3k
views
Docker image with python and crontab
I am trying run a docker container with python code and crontab (scheduler)
below is my script:
Docker file
FROM ubuntu:latest
MAINTAINER [email protected]
RUN apt-get update && apt-get ...
0
votes
1
answer
804
views
How to change my cron job to auto update the geolite2?
A Prestashop e-commerce website is using MaxMind's GeoLite2-City database for country blocking. Instead of geoipupdate it uses this cron command to keep that database up to date:
/usr/bin/curl -L --...
1
vote
1
answer
6k
views
Cron jobs not running on Kubernetes + Alpine linux
I am trying to run a cron job on Alpine Linux docker image which is then pushed in Kubernetes container. The Cron job is that I want the container to restart itself after every 15 mins. So my command ...