Questions tagged [cron]

cron is a task scheduler based on clock time that runs on Linux-based machines.

Filter by
Sorted by
Tagged with
0 votes
1 answer
18 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 ...
user avatar
0 votes
1 answer
34 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 ...
user avatar
1 vote
2 answers
45 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 ...
user avatar
  • 188
0 votes
0 answers
26 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/...
user avatar
  • 1,483
2 votes
1 answer
46 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 ...
user avatar
2 votes
1 answer
32 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: /...
user avatar
0 votes
0 answers
32 views

How do I find all php binary path's on a linux server?

A server has multiple php custom versions, which were installed with ISPConfig 3. I am trying to find the path to each version so I can run a cron with the specific binary. I have tried the following ...
user avatar
0 votes
0 answers
22 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 ...
user avatar
0 votes
1 answer
122 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 ...
user avatar
0 votes
0 answers
21 views

How to start bash script which is activating screen with the python program via cron?

I'm trying to start this bash script via cron which activate python virtual enviroment and then put python program in the screen to work while the server is running since it's a bot This is a bash ...
user avatar
  • 1
0 votes
1 answer
31 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 ...
user avatar
0 votes
0 answers
26 views

cronjob for Optimus Cache Prime (OCP)

For Optimus Cache Prime (OCP) https://patrickmn.com/projects/ocp/ I have to make a cronjob. The say that is has to be : ./ocp /home/patrick/sitemap.xml but what do i place before ./ocp because for the ...
user avatar
  • 1
0 votes
0 answers
16 views

Linux backup to local NAS using Anacrontab and Rsnapshot?

I've set up a backup of my Linux machine to a local NAS storage which is attached to a local network switch. My anacrontab is set-up to do daily backup every 1 day, weekly every 7 days, and monthly ...
user avatar
  • 645
0 votes
0 answers
57 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@...
user avatar
  • 43
0 votes
0 answers
23 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 ...
user avatar
1 vote
1 answer
51 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 ...
user avatar
  • 111
0 votes
1 answer
23 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[...
user avatar
1 vote
1 answer
53 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 ...
user avatar
  • 156
0 votes
1 answer
35 views

Crontab task does not work, Linux, Debian

At a Debian server I've set a crontab task using crontab -e with the following content: */2 * * * * /usr/bin/php /root/scrapers/terra_plf/terra_swap_api.php Why doesn't it work? When I run the same ...
user avatar
0 votes
1 answer
392 views

"/bin/sh: 1: Syntax error: redirection unexpected" in crontab's outputs

In crontab I have this job script : 0 5 * * * /home/user/job_h.bash > /home/user/log_h.log > 2&1 where the job_h.bash contains : #!/usr/bin/env bash set -e source /home/user/pyenv/test/bin/...
user avatar
0 votes
1 answer
65 views

Cron files copied directly into /var/spool/cron/crontabs do not execute

Copying a crontab file directly into /var/spool/cron/crontabs/<username> does not schedule the job for execution. crontab -l shows the file contents, so cron is at least somewhat aware of it. ...
user avatar
0 votes
0 answers
23 views

`run-one-constantly` not working as expected

I am running a script that monitors a directory for incoming file which must be processed as fast as possible. To avoid downtime if the script crashes, I used a cronjob calling run-one <script> ...
user avatar
  • 151
1 vote
1 answer
136 views

Understanding how pgrep determines process IDs

I'm currently refactoring a script that works well if executed in terminal directly but exits early due to a process check if executed from crontab. This early termination is caused by code using a ps ...
user avatar
  • 13
0 votes
1 answer
71 views

The rust file is not working as I `cargo run` with crontab

I type sudo -i to proceed to edit commands of crontab. I've written the following line inside the file of crontab. @reboot cd /home/username/superuser && cargo run; The following content is ...
user avatar
0 votes
1 answer
22 views

CPanel cron job - taking UK's DST into account

Is there a way to take the UK's daylight savings time (GMT vs BST) into account when setting up a cron job in cPanel (hosted with GoDaddy if it makes any difference)? I doubt it, and it's not ...
user avatar
1 vote
1 answer
89 views

Script in crontab only partially executed

My scenario: I've some python scripts on a raspberry pi. They behave like a service, they run forever without exiting and process signals. They are meant to run in the background, writing some values ...
user avatar
  • 295
2 votes
1 answer
82 views

Why is my script running if run with cli but not with crontab?

On WSL Ubuntu 20.04 I have two scripts (one sh and one python) that run perfectly if I launch them with bash, but not with cron. The second (python) script is supposed to run just if the first (bash) ...
user avatar
0 votes
0 answers
14 views

getting .sh file to run in cron

I wrote test.sh file to get to run helloworld.py every minute. test.sh is the following: #!/bin/sh python3 helloworld.py I ran chmod +x /home/blackwidow/Desktop/test.sh in the command as well to make ...
user avatar
1 vote
1 answer
326 views

How do I stop a currently running cron job executing wget?

I added a cron job to prime the cache of my website. The command is: cd crawler && wget --recursive --no-parent --domains=example.com --level=inf --reject css,js,png,jpg,mp4,psd,pdf --delete-...
user avatar
0 votes
0 answers
12 views

use part of a flag file name as parameter for encrypting a file

I have a program that creates a flag file that looks like this SendPaysource.66169592. There is also a corresponding data file that looks like this WSPGLOBAL.PAYMENTS.ISO20022_PAIN_01Ver3.66169592.xml ...
user avatar
  • 1
0 votes
0 answers
142 views

Ubuntu - Crontab seems to be running my script but not actually doing anything?

Ubuntu 18.04.5 LTS Bionic sudo crontab -e */5 * * * * /bin/bash -c '/root/checker.sh' checker.sh #!/bin/bash if ! (systemctl is-active varken.service) then /bin/bash -c 'service varken start' fi /...
user avatar
0 votes
0 answers
27 views

How to modify content in a constantly changing file using bash and cron job?

I have several log files that are continously updated at different times. I'm trying to write a bash script to mask or remove email addresses in the log files as the files are updated. A cron job will ...
user avatar
  • 1
0 votes
0 answers
19 views

Execute a command on filesystem event based scheduling

I'm in an attemp of keeping my files ordered and traceable under linux. As you know many issues present: cdate is not mantained, every other dates are modified with every copy, results are piles of ...
user avatar
0 votes
0 answers
25 views

Mac mount smb share and cronjob

Hey there maybe somebody can please help me there are 2 things I would like to achieve. I have a script file that I want to run once a week automatically. I have 2 questions for that: In the script I ...
user avatar
  • 43
0 votes
1 answer
103 views

rm -rf no longer deletes folder in cron job

I wrote a program that writes a large number of small files to a temporary directory, then, via a call from within the program, deletes the temporary directory. This program is called via a user-...
user avatar
0 votes
0 answers
46 views

Use git to track changes to repo very often

I write a lot of org-mode notes in several files in a git repo. I want to be able to use git log -p to support two types of queries: See what I wrote on a given date, or a given range of dates. Find ...
user avatar
0 votes
0 answers
119 views

Stopping and Starting systemctl Service via Cron job

So I have created a service on my Raspberry Pi 3 using the method described here. I can stop and start the service from a Terminal session easily enough, and the service starts at boot. However I ...
user avatar
  • 1
0 votes
0 answers
24 views

How can I use a cron job to execute a script inside a chroot?

I have a Synology NAS 213j with many limitations due to its armel architecture. Via entware-ng I have a chroot with debian stretch running on it, which at least let me do a few more things. Now I ...
user avatar
  • 1
0 votes
2 answers
168 views

Speedtest-CLI Cron Job Not Working

Cron job is setup as: */15 * * * * speedtest >> /home/pi/speedtest.log The speedtest script is: #!/bin/sh speedtest-cli --csv >> /home/pi/speedtest.log That uses Speedtest-CLI. The job ...
user avatar
  • 177
1 vote
1 answer
483 views

Why did my default crontab editor change?

I have an Amazon Linux instance I have been using for years as a web server. It's been awhile since I've logged in. Today I logged in and noticed the default crontab editor has been changed from ...
user avatar
  • 228
0 votes
0 answers
31 views

bash script is not running

I have a Flask project running inside a kali vm, the webapp is running fine but I would like to run it at boot to be able to test it from another vm created a .sh script echo "Starting Flask ...
user avatar
1 vote
1 answer
337 views

"/usr/sbin/shutdown now" not working in crontab in WSL in win10

Recently I started using win10 and WSL. I want to let crontab run the following command. /usr/sbin/shutdown now But it's not working even the command works in Linux OS (I checked it already). The ...
user avatar
0 votes
0 answers
29 views

Bad number error on boolean variable

I am running a script as a cron job on my company's TrueNAS box for backing up data to a synology Box located offsite. I am using a series of rsync commands which they are completed susccesfully ...
user avatar
  • 3
1 vote
1 answer
221 views

Failure to change my desktop background via crontab

I have a shell script called test.sh: #!/bin/sh touch /home/me/testing.txt /usr/bin/gsettings set org.gnome....
user avatar
0 votes
1 answer
25 views

How do I test existence of two mounts in cron before proceeding with rsync?

I have two mounts, in ubuntu, (one of which is a finicky windows share I'm backing up), and to prevent messes, I'd like to check mount existence of both, before the next step. I tried: if grep -qs '...
user avatar
0 votes
1 answer
116 views

Anacron running daily tasks hourly instead of daily

I have Anacron set up to run a backup daily, weekly and monthly. The monthly seems okay, but the daily and the weekly are running roughly every half hour every day! Here is my /etc/anacrontab # /etc/...
user avatar
-2 votes
1 answer
19 views

Can't figure out why a cron job isn't working

I have an odd situation where I have a cron job set up to execute a shell file once a day, and based on the syslog the cron job IS being called as intended, and by the proper user that should be ...
user avatar
1 vote
1 answer
493 views

Crontab not logging to file

I have the following cronjob: @reboot /usr/local/bin/python3.9 /home/pi/push_bullet/push_bullet_socket.py >> /var/log/push_bullet_socket.py.log 2>&1 It's the only thing on my crontab. ...
user avatar
  • 13
0 votes
1 answer
46 views

Thunderbird/Outlook if mail not received last 24 hours

I have some routine emails that are sent every day, they are automatically going in some folders. However, if I don't receive the mail in the last 24 hours I want to have an alert, in thunderbird or ...
user avatar
  • 1
1 vote
3 answers
124 views

Ubuntu: Environment variables set in .bashrc but not being used in cron?

I have set some environ varibales in .bashrc but they end up as None when the script is run by cron. When I run it using python3 it works perfectly. Set the variables: nano .bashrc .bashrc export NBB=...
user avatar
  • 111

1
2 3 4 5
18