Questions tagged [cron]
cron is a task scheduler based on clock time that runs on Linux-based machines.
897
questions
0
votes
0
answers
10
views
Intermident DNS resolution failure in cron scripts only
I have a simple backup-script, running on a local server(Barebone mini-pc).
The backup script is executed by cron, at a specific time at night.
It used to work without an issue, but since a power-...
0
votes
0
answers
10
views
CronJob on MacOSX seems to be delayed. Is it normal?
I am running a cronjob on MacOSX. It just prints some information on a file every 5 minutes.
I added a date command, and I see that the job runs sometimes after 10-15 seconds, but other times it can ...
0
votes
0
answers
3
views
profile sync daemon crontab necessary?
I'm running ubuntu 22.04 and installed profile-sync-daemon. The configuration was pretty easy by simply using the defaults and activating the daemon:
systemctl --user start psd
systemctl --user status ...
0
votes
0
answers
18
views
Executing a service automatically or a script on init without a init system or cron
Little background: I have this Synology server with Linux that is running Docker Images. There is one docker image that has a ton of content already within and I cannot recreate it, so basically is ...
0
votes
1
answer
29
views
Run Command after Laptop unfold
I want to run a bash file at a specific moment a day. (8:00 and 20:00).
I've already managed to do this via crontab and also on startup if my computer was shut down at the time. My only problem is ...
1
vote
2
answers
48
views
Running shell Script via Crontab
So I've tried to run a shell script via crontab.
My Crontabs look like this:
00 20 * * * $HOME/Bilder/Hintergründe/.background_skript/background_night.sh
and my background_day.sh looks like this:
`#!/...
1
vote
1
answer
29
views
How to tell which files are new or have been modified between calls of a script
I want to call a shell script regularly, and in it I need to process the files present in a directory tree that are new or that have been modified since the previous call of the script.
My 1st thought ...
0
votes
0
answers
17
views
sendmail cron job successfully sends out emails, but emails are not reaching my inbox
I created a script /etc/cron.hourly/test-hourly to send an email to me:
#!/bin/bash
EMAIL_TO="example@example.com"
EMAIL_CC="example@example.com"
SUBJECT="Cron hourly test $(...
9
votes
5
answers
3k
views
Cron can't find executable which works in terminal?
I've written a small tool in C++, compiled it, made it executable, and move it to /opt/tools/bin. The latter is a directory I created to store small, custom programs. I export it to $PATH in my ....
1
vote
0
answers
24
views
Where are the files generated from a binary launched using launchd?
I am trying to setup a cron job using launchd, seemed quite straight forward with systemd on linux, but on mac, even though I have the process running (it is a local server, and I can confirm the API ...
0
votes
0
answers
48
views
How to prevent systemd.timer immediately restart a service?
I have a daemon service that needs to keep working 08:00~16:00 every workday, and I want it exit at 16:00, and keep exited at rest time range and weekend.
I make a systemd.timer for it as following:
[...
0
votes
0
answers
31
views
mount and systemctl not executing inside crontab
Under root, i run crontab -e and write :
0 21 * * * systemctl stop transmission-daemon && umount /mnt/WD5 && hdparm -y /dev/sda
I also tried
0 21 * * * mount /mnt/WD5
None of them ...
0
votes
0
answers
19
views
CRON to Check if a webapp is working properly and report what happened if not
This is my first iteration in bash:This webapp does not have postgres but Apache 2.4, Tomcat 8.
I check first the 200 http response. Then if http server is running and if the tomcat also does.
I ...
0
votes
0
answers
89
views
anacron Can't open timestamp file for job cron.daily: Permission denied
Why is anacron failing to run jobs? I just added a weekly backup job, but it fails to run with anacron -f.
Here's the error in journalctl: anacron[28209]: Can't open timestamp file for job cron.daily: ...
0
votes
2
answers
74
views
Cron job supposed to run on Tuesdays are running other days?
I have the following Cron rule:
0 8 1,2,3,4,5,6,7,14,15,16,17,18,19,20 * 2 /root/command.sh
My objective is to run the /root/command.sh on Tuesday every two weeks.
Crontab.guru returns the following:
...
2
votes
1
answer
67
views
list of files (ls /dev) is different when run on command line vs. via crontab
Why can't cron ls certain files in /dev using my script ?
The script can list /dev completely when run from the command line. The same script run from either cron setup cannot see (list, ls) most of ...
1
vote
1
answer
161
views
not able to mount filesystem (sshfs) using crontab
I have sh script file which works properly when running from command line using -
./start.sh
which starts a tomcat server and mounts a drive with sshfs
But when i do
crontab -e
@reboot /home/start....
0
votes
2
answers
33
views
How to setup cronjob with automated emails in linux?
I've been working on creating a script to scan a series of mailboxes on a linux server, find ones that have more than 250 emails in the mailbox, and then send an email with the name of those mailboxes ...
0
votes
0
answers
63
views
Linux Apache server that was running out of memory and swap
My server was out of memory from 3 to 10 am. I was trying to identify the root cause of that.
Dec 15 10:00:01 ip-10-0-10-143 systemd: Created slice User Slice of root.
Dec 15 10:00:01 ip-10-0-20-143 ...
1
vote
0
answers
289
views
Nginx: How to close connections that have been open for over an hour?
I am using an Nginx server with Debian 11 to offer download resources.
I need to reset client connections that have been open for over an hour.
Currently, I restart the Nginx service via a cron job ...
0
votes
1
answer
346
views
php and apache not seeing anything in there defined tmp dirs
we have standard php and apache but not seeing anything in there defined tmp dirs
How to check logs for non application 500s?
I have actually 2 issues one is routing logs for https://www.test.com
...
0
votes
1
answer
55
views
SSH Tunnel via crontab with 2FA gives EOFError
I'm trying to setup a crontab which opens an ssh tunnel. Unlike other questions here and on stackoverflow, the server I'm connecting to has a 2FA which prompts the user for a password. However, I don'...
0
votes
0
answers
29
views
I created a cronjob years ago, now it is still running on the server but I can't locate it with "crontab -e", what can I do?
two years ago I created a cronjob which execute a python script to backup stuff. Now, the thing is that this cronjob is still running:
/var/log/cron.log.1:Oct 9 20:00:02 syslogngsrv CRON[28292]: (...
0
votes
1
answer
41
views
Cron Disrupting VBoxManage Commands
I am on Ubuntu 20.04 desktop, running Virtualbox 6.1 and I use Webmin to run a very simple cron job to take daily snapshots of my virtualbox test server as follows:
VBoxManage snapshot VminServer ...
2
votes
1
answer
76
views
Cron task set to change Gnome 3 background doesn't update the background
I've made this simple script:
#!/bin/bash
# If started as root, then re-start as user "cyril":
if [ "$(id -u)" -eq 0 ]; then
exec sudo -H -u cyril $0 "$@"
fi
wget -...
1
vote
0
answers
104
views
Trigger graphical password prompt from a cron job
I have a few script to automate linux system backups with Borg. But those script need me to input a password through pinentry (gpg password prompt), in order to unlock my SSH key or the backup ...
0
votes
1
answer
79
views
wordpress automatic updates via cron no root privileges?
this script is run by update.sh wich is run by cron every day at 2 o'clock, it allows wordpress to be updated automatically via cli (needs to be installed before) actually runs fine, when run as root
...
0
votes
0
answers
36
views
When is the right time to set up iptables after system reboot?
I have a shell script that sets up a packet filter using iptables. The script works fine, but since im using iptables, the configuration gets reset after a system reboot and the packet filter no ...
0
votes
0
answers
88
views
Why is my Cron unable to find a binary under $PATH? [duplicate]
Today I noticed that one of crontab doesn't run. I checked /var/log/cron which says :
Aug 8 13:41:25 alpha crontab[20061]: (root) BEGIN EDIT (alpha)
Aug 8 13:41:29 alpha crontab[20061]: (root) END ...
0
votes
0
answers
176
views
scheduling python script with crontab (mac) - unable to import required dependencies
I am trying to use crontab to schedule a python script to run every day, but I'm getting this error:
Traceback (most recent call last):
File "/Users/name/Desktop/Scrape/scraper.py", line 5,...
0
votes
0
answers
83
views
Screen fails to properly load when called with crontab
What I'm doing
I've been migrating one setup to another, copying configuration and installing dependencies, I was about to be done until screen didn't work as intended.
I have a script that I keep ...
0
votes
1
answer
98
views
cron.d script launching then dying
Many stack posts seem to suggest something like:
* * * * * root /usr/bin/pgrep -f 'socat -T10 TCP4-LISTEN:22222,fork UDP4:localhost:22223' || (/usr/bin/socat -T10 TCP4-LISTEN:22222,fork UDP4:localhost:...
0
votes
0
answers
118
views
How to stop cron messages getting sent to syslog?
I'm sending logs to a syslog server, but cron logs there are taking up more space than they should (and I don't need to see them). Every hour, I get messages like
starting 0anacron
finished 0anacron
...
0
votes
1
answer
135
views
Duplicity cron not working
I'm trying to run Duplicity backups via a cron script with --encrypt-key and a GNUPG key ID (from gpg --list-secret-keys).
It's failing with /root/backup.sh: 5: --encrypt-key: not found but if I ...
0
votes
0
answers
136
views
git produces no output when called from script via cron (log/shortlog)
I've got a script git-test going to a local git repo and calling git shortlog to keep track of recent changes. For testing purposes, I just used these lines:
#!/bin/bash
cd /myrepo.git
result="$(/...
1
vote
1
answer
4k
views
How to properly use environment variables in crontab
I export a variable in my ~/.bashrc file (Ubuntu 20), which I'd like to use in a cron job.
Searching for answers, I found two ways of doing it, but none worked for me:
12 11 * * * BASH_ENV=/home/l86/....
1
vote
2
answers
1k
views
Ansible playbook runs from user, but not from crontab
I have a weird behavior on a crontab job I'm trying to run using Ansible's playbook.
First of all, I have similar crontab's lines using Ansible playbooks that works perfectly, so the issue is either ...
0
votes
1
answer
424
views
Updating SSL Certs with PKCS12 or PEM via Bash Script
I currently have my pi-hole setup to request an SSL cert from ZeroSSL using Acme.sh, this works quite well.
I then have to cat the two cert and key files into one, and then relaunch the lighttpd ...
1
vote
2
answers
924
views
Unable to get sudo to work in script when using cron
Environment: RHEL7.9
Access: No root access. I have sudo access to some commands (no password)
Issue: my personal crontab calls a script with sudo, sudo isn't working.
I have a script.sh that calls ...
0
votes
0
answers
541
views
Why does cron log to auth.log every 30 minutes?
I have a virtual machine running Ubuntu with these cron settings, four jobs running once a day:
10 6 * * * cd $HOME/...
30 4 * * * mongodump ...
30 4 * * * . .bashrc && ...
10 4 * * * cd $HOME/...
2
votes
1
answer
387
views
How to shut down and start up Debian server on a preset schedule?
I have a basic home server running Debian 11, which I am using to self-host a few things. I would like to set it up, so that it does not run during the night. Basically, I am doing this out of noise ...
2
votes
1
answer
145
views
Debian cron cannot find /var/backups after accidentally moving /var
I'm dumb and accidentally moved everything in /var to a subdirectory of the root directory. I realized my mistake and moved it back, but now I'm getting this weird error mailed to me every morning:
/...
0
votes
0
answers
103
views
Delete all directories on a ftp folder except ones I list cronjob?
Is there any way for me to delete all folders in a given ftp folder using a cronjob, and the deleted files are folders older than x hours, with a few specific folders that are not deleted that I ...
1
vote
1
answer
4k
views
ssh commands in cron jobs on remote server
It is known that cron and ssh-agent do not communicate and hence ssh commands cannot be trivially run under cron. There are solutions involving keychain etc that make it possible to do this. However ...
1
vote
1
answer
5k
views
Execute sudo command in cronjob (vestacp/ubuntu)
Is it possible to add cron command like "sudo systemctl restart exim4"? Usually in cronjob's list there's a path to the execution file, but looks like vestacp has list of other commands ...
0
votes
0
answers
451
views
crontab -e: crontabs: No such file or directory
I am trying to set up a cron job in my user crontab on a debian 11 image on a VPS.
But I have issues and cannot open crontab:
flo@debian-2gb:~$ crontab -e
crontabs: No such file or directory
flo@...
0
votes
0
answers
42
views
Cronjob not working properly when run as scheduled
This file is placed in /etc/cron.weekly/ :
#!/bin/sh
# For syncing some files with OneDrive
# Assumes that the sync target is set up as OneDrive:Syncs in rclone
if [ $(id -u) -eq 0 ]; then
exec ...
2
votes
1
answer
143
views
Additional crontab stored in a git repository
I have an app that has some functionalities that are scheduled via crontab.
Is there any way for me to keep these crontab-launched commands in a git repository, and at the same time add them to the ...
0
votes
1
answer
45
views
Check if file crontab runs
I've set up crontab tasks to be executed every min.
* * * * * sudo /usr/bin/php /root/scrapers/terra_plf/terra_swap_api.php
I see its log in var/log/syslog file:
Jan 3 15:14:01 clearthefog CRON[...
1
vote
1
answer
675
views
Setting $DISPLAY with cron
I've been trying to get my screen to lock every half hour, and thus far it hasn't been effective, as cron (or technically my client, cronie) throws errors and does nothing. Errors below (sourced from ...