Skip to main content

Questions tagged [cron]

Cron is used to execute scheduled commands. It acts as a task scheduler on Linux and UNIX systems which will execute commands at specified times set by the user. Cron has a great deal of customization and is often used on server environments where common tasks are run on a regular basis.

Filter by
Sorted by
Tagged with
0 votes
1 answer
10 views

What would be a "cron" alternative?

I'm reading that using cron for scheduled and repeated tasks could be a safety risk. Moreover, some other systems are deprecating it... Now, in the minimized server version of UBUNTU 24.04.1 LTS, it ...
Hristo's user avatar
  • 73
0 votes
1 answer
18 views

How to Delete All Files from a Directory Daily Using Cron?

I need to delete all files from a specific folder every day using a cron job. My current crontab entry looks like this: 0 22 * * * rm -rf /var/www/abcd/app/Management/application/session/* However, ...
Saksham Paliwal's user avatar
0 votes
0 answers
22 views

Crontab with proxy

I have an issue : I add inside /etc/profile.d/proxy : export http_proxy=http://IP:80/ export https_proxy=http://IP:80/ export ftp_proxy=http://IP:80/ export no_proxy="localhost,127.0.0.1,...
Hab's user avatar
  • 9
0 votes
1 answer
31 views

set env variables from a cron job

I am trying to run a script in a cron job on reboot to set an env variable to be used later (by PM2) I have tried to source the script when running in crontab with . /home/myuser/scripts/startup.sh I ...
Lelio Faieta's user avatar
0 votes
1 answer
43 views

Crontab isn't working with reboot parameter

I did a crontab job for my user with crontab -l. After that I ran crontab -e and selected Nano. Then I entered my command: @reboot expressvpn connect "USA - Michigan" When I login with my ...
Matt Gregorin's user avatar
3 votes
1 answer
67 views

Open URL in Current Firefox Session via Crontab

I have firefox session open. I want to open an URL from crontab. But I want crontab to open the URL in my currently open firefox window/session. My crontab entry is: * * * * * export DISPLAY=:0 &&...
podcast's user avatar
  • 106
0 votes
1 answer
35 views

kubuntu 22.04 won't run PHP cronjobs normally anymore (logs stay empty, script is never ran)

i have a PHP script that has ran correctly up to about 3 or 4 days ago, also from crontab. it fetches RSS news items and puts them into a db. the problem i have at the moment is that this script will ...
Rene Veerman's user avatar
0 votes
0 answers
105 views

cron fails to launch @reboot script

Running 6.8.0-45-generic, Ubuntu 24.04 LTS I have a bash script, it launches in Terminal with /path-to-script/script.sh I want to have it launch on reboot, so in my crontab I have @reboot /path-to-...
That Jack Elliott's user avatar
0 votes
1 answer
21 views

backup of db after reboot or maintenance with scheduling using crontab

Implemented a script in bash that backups a postgres db and added in my root user crontab: $ sudo crontab -e 0 3,14 * * * /usr/local/bin/backup.sh 10 >> /mnt/backups/backup.log so it would run ...
H.C's user avatar
  • 103
1 vote
1 answer
33 views

Wrong date in startup message

I have a server A that sends a syslog message to another server B's rsyslog daemon, whenever it (A) starts up. To that end, I included in the root's crontab a directive similar to: @reboot logger -T -...
Jos's user avatar
  • 30k
0 votes
0 answers
59 views

How to give user permission to use udisksctl? [Ubuntu LTS 22.04]

I don't have the rep yet to be able to comment on the existing post, so I'm forced to make a new post. Apologies. GOAL: To be able to mount USB drives on boot without loading the GUI to be used for ...
DasKraut's user avatar
0 votes
0 answers
39 views

My systog file is 3GB with a systemd error every 2-3 seconds

In the last couple days Ive started getting a system freeze which needed a hard restart each time. After some online research I checked the syslog file and found it to be over 3 GB for just the last 5 ...
flexone's user avatar
0 votes
0 answers
126 views

Cron job does not run properly

I can not get my crontab to run a script that suspends my computer. The script runs o.k. from a terminal. ~$ grep CRON /var/log/syslog 2024-09-22T05:15:01.538005-05:00 andy-To-be-filled-by-O-E-M CRON[...
fixit7's user avatar
  • 3,353
0 votes
0 answers
37 views

Installing crontab

I'm new to Linux and getting the below error when running the crontab -e command. SHELL=/bin/bash PATH=/usr/bin:/bin:/usr/local/bin MAILTO=root 0*****ls -la $(find .) | sed -e 's/..csv/#####.csv/g' &...
kennedy langat kipkosgei's user avatar
1 vote
0 answers
81 views

cron job is not executing a python script

i have a cron job that i expect it to execute a python script. Here is the cron job : * * * * * /usr/bin/python3.8 /config/workspace/test/twg_api.py >> config/workspace/logfile.log 2>&1 ...
Ret3i's user avatar
  • 23
2 votes
1 answer
79 views

Crontab: Is it possible to run different commands on different timezones?

I know that CRON_TZ= will set the timezone cron runs for all commands. However, I'd like for some cron entries, not all, to run on specific timezones. Is this possible? If not directly possible, do ...
Majal's user avatar
  • 8,199
1 vote
1 answer
1k views

Can't mount NAS shared folder on startup with crontab

I made a sh script to mount my Synology shared folders via LFS. It works like a charm, here's the code (xxxxx stands for the IP adress of my nas) #!/bin/sh #Mount the following folders on Komputer ...
Harold's user avatar
  • 13
1 vote
1 answer
228 views

upgraded from 22.04 to 24.04 last week, my crontab entries that play a short video (.asf) at different times, do not play if the display is locked

I checked my Power settings, ScreenBlank is set for 10 minutes, Automatic Suspend is Off, PowerMode is Balanced. When I unlock the Display lock via providing my password, I will have all the crontab ...
gmoore777's user avatar
1 vote
0 answers
41 views

Crontab isn't changing my wallpaper

#My crontab -e (conf)- * * * * * /home/barmanji/random_wallpaper.sh #My random_wallpaper.sh (conf)- #!/bin/bash nitrogen --set-zoom-fill --random ~/Downloads/ColorWall #I am new to linux and ...
Barmanji's user avatar
1 vote
1 answer
84 views

suspend crontab until next system boot

How would I suspend all use of crontab until the system is rebooted? The system runs ubuntu 24.04. I say all use because several IDs on the system have crontabs.
thing1's user avatar
  • 79
-1 votes
1 answer
179 views

How to run docker compose from sudo crontab?

So, I have a very simple problem: I am running a minecraft network via Docker compose. That compose file is stored in a folder on my user desktop, so it is ./Desktop/.../docker-compose.yaml when I ...
nickycom's user avatar
0 votes
0 answers
43 views

Why can't crontab bash script access user .local directory?

My cronjob is running. But the bash script that is running does not properly invoke another program. Usually, including a full path resolves this issue. I've included a full path in my bash script but ...
www139's user avatar
  • 163
0 votes
0 answers
71 views

Ubuntu allows user to sudo without password even though it's not allowed + missing crontabs

1 - Problem with unprotected sudo I have an Ubuntu 22.04.4 LTS server that runs for a few years non stop. I didn't notice anything strange during that time, as well as I didn't change any server's ...
mrudawski's user avatar
0 votes
0 answers
46 views

Where to get current http_proxy setting

I have an Ubuntu (22.04) machine, where the proxy is set from GUI. I have a job running in crontab. How can I access the actual proxy settings from the cron job? In normal shell, there is an env ...
pihentagy's user avatar
  • 101
2 votes
1 answer
383 views

Wifi deteriorates over time; cronjob to restart network manager

I have an issue with my Ubuntu machine and WIFI, which apparently is difficult to resolve. Turning off and on the wifi fixes it (temporarily). When trying to connect from outside and the speed is very ...
FooBar's user avatar
  • 735
0 votes
0 answers
28 views

Issue runing a background image changing script with crontab on reboot [duplicate]

Im trying to create a script to change the background image on startup. I created a file with this code: REAL_UID=$(id --real --user) PID=$(pgrep --euid $REAL_UID gnome-session | head -n 1) export ...
Xxale137xX's user avatar
0 votes
0 answers
22 views

crons started executing only post uncommenting lines in /etc/pam.d/common-auth

My crons were not getting executed on my Ubuntu 20.04 server until I found out that these lines needed to be uncommented in /etc/pam.d/common-auth auth [success=1 default=ignore] pam_unix.so ...
anjanesh's user avatar
  • 683
0 votes
1 answer
91 views

How to shutdown a PC at a specified time, with option to cancel?

I have been experimenting with the crontab file and making a .sh script file, but I haven't been able to either: cancel the shutdown or reliably show a message in the terminal as a "warning" ...
John Paasche's user avatar
4 votes
1 answer
819 views

Environment variable LOGNAME or USER does not correspond to effective user id

I'm running an Ubuntu 20.04.6 LTS server. The server hosts some Virtualbox virtual machines that I backup with a bash script on a daily basis. That works quite fine. The bash script also sends some ...
Matth's user avatar
  • 61
0 votes
1 answer
74 views

redirection operator now fails in cron job after migrating to cloud

I have a line like this on my cronjob: 22 9 * * 1-5 cd ~/execution/samples/Cpp/data_logger/; ./data_logger_static 127.0.0.1 $TWS_LIVE_PORT &> SPY-STK.csv It worked great and wrote a bunch of ...
Taylor's user avatar
  • 159
0 votes
0 answers
27 views

Running shell script with crontab but output is not displayed in the terminal [duplicate]

An enthusiastic Linux learner asks this: The abarco user is trying to run a simple shell script with crontab. Here the script: myjob.sh: #!/bin/bash echo Hello i am running $0 at $(date) The script ...
luis arturo barco gonzalez's user avatar
0 votes
1 answer
165 views

how to write cronjob

I tried to setup cronjob for python script erpnext_sync.py which is in located at /home/user_name/frappe-bench/biometric-attendance-sync-tool $ crontab -l * * * * * /usr/bin/python3 -c 'from ...
fit's user avatar
  • 1
0 votes
0 answers
180 views

Why is the plocate database not updating?

In one of my computers (C1), the plocate database is not updating, see command #2 below, run today 03/21, showing a database last updated on 03/14 (it was manually updated). The configuration is ...
sancho.s ReinstateMonicaCellio's user avatar
0 votes
0 answers
61 views

Failed to logout using cron

I am trying to log off using editing crontab -e with the command * * * * * gnome-session-quit However, after one minute it is not asking or going for logout. Can anyone help me why is this the case? ...
Muhammad Zohaib Zafar's user avatar
1 vote
1 answer
575 views

Scheduled a computer to reboot everyday at 7AM, not sure if I did it correctly

Running Ubuntu 20.04, I have computers that I want to reboot everyday at 7AM. I followed these instructions, and I thought it was working, but now when I use the uptime command, it will often report ...
Jackjackson's user avatar
0 votes
1 answer
139 views

Start @reboot crontab script in a new tmux/byobu session and be able to connect to it

I have a crontab entry that starts a backup job script after reboot: @reboot (sleep 120 && bash /srv/recvuser/cron_autostart.sh) 2>&1 | /usr/bin/mail -s "SuperServer ZFS Backup&...
Alex's user avatar
  • 149
2 votes
1 answer
120 views

I need to automatically start a non GUI application through a terminal line because I don't have a GUI

I have a proxmox ubuntu container running ubuntu 23.10 and becuase it is a container it doesn't allow me to use a GUI. I need to run a server application as soon as the container boots up incase it ...
jelacksmith626's user avatar
3 votes
2 answers
768 views

unable to mount external drive from cron (using udisksctl)

GOAL I'd like to mount an external drive using cron for automatic backups, preferably with udisksctl. PROBLEM udisksctl mount -b /dev/sdXY works fine from the command line or shell script, but when I ...
petermao's user avatar
1 vote
0 answers
87 views

Error when running docker desktop from cronjob

I have a script that checks every minute if docker desktop is running. If it fails, it should launch docker desktop. My script works fine if I run from command line, but it fails when I run it by ...
KingKongFrog's user avatar
0 votes
1 answer
1k views

Script to notify via email when low on disk space

I found the below mentioned script on the internet, which notifies via email when server gets low on storage or as per defined. I run it every 5 minutes, if i am low on storage it keeps notifying me ...
Blohsh's user avatar
  • 3
2 votes
1 answer
189 views

Cron not running script on boot

The main idea is to make my pc run a script on boot in wich x11docker takes care of lifting a container with a youtube video. this is mi crontab -e: @reboot /usr/local/sbin/script-exo.sh script im ...
ømen's user avatar
  • 21
1 vote
1 answer
64 views

cron not working as intended

This works * * * * * export DISPLAY=:0; /usr/bin/vlc --play-and-exit /home/tc/Music/test.ogg But this doesn't 30 8 * * * export DISPLAY=:0; /usr/bin/vlc --play-and-exit /home/tc/Music/test.ogg I ...
The Meditation Center's user avatar
1 vote
1 answer
126 views

/usr/sbin/anacron kills dovecot and postfix

I am running dovecot and postfix on a 22.04.3 LTS Ubuntu server. Every day at 6:25 first the dovecot server and then the Postfix server gets stopped (it started about a month ago). It starts again ...
Lukas's user avatar
  • 41
0 votes
2 answers
1k views

cron unable to run .sh script - 22.04

I am trying to run a simple script that checks the battery percentage and shows it through a notification (notify-send). The script runs correctly if ran from terminal manually: ~/path-to-script/...
overmach's user avatar
0 votes
0 answers
23 views

How to alter screen dimming routine on Ubuntu 23.10? [duplicate]

My Android cellphone did the same thing. It had a mode/routine that kicked on every night. Some power feature.I edited the timer to go off at 3am and all has been peachy on my phone. Ubuntu is doing ...
brad's user avatar
  • 160
0 votes
0 answers
61 views

Crontab -l not reporting any jobs after /etc/crontab edit

I want to run a Python script at certain intervals. So I edited the /etc/crontab file and added this: */2 9-10 * * 1,2,4,5 administrator DISPLAY=:0 python3 /home/administrator/main.py So I want to ...
Mathias's user avatar
0 votes
1 answer
667 views

Why does my powershell script run with "pwsh" but doesn't with "sudo pwsh"?

I'm still somewhat new to Ubuntu / Linux so please bear with me if I'm not using correct terminology. I'm on Ubuntu 20.04 but I use Putty to perform everything via the terminal. I'm using a collection ...
tl6277's user avatar
  • 1
0 votes
1 answer
247 views

crontab -e stopped working for non-root user, /bin/sh: 1: mvim: not found, ubuntu 22.04

The command crontab -e has stopped working under non-root user accounts and gives the error: /bin/sh: 1: mvim: not found crontab: "mvim" exited with status 127 However, it still works for ...
Paul B's user avatar
  • 103
0 votes
1 answer
702 views

xterm: Xt error: Can't open display: :0

I have a cronjob that didn't work this morning. The line in crontab -e looks like this: 20 9 * * 1-5 export DISPLAY=:0 && /bin/bash /opt/ibc/twsstart.sh I couldn't find any errors in /var/log/...
Taylor's user avatar
  • 159
0 votes
0 answers
97 views

Is It Possible To Run A Command In A Running Cronjob [duplicate]

On my computer Ubuntu 22.04.3 LTS I'm hosting a minecraft server that starts and stops automatically using crontab. is there a way I can type a command (/tellraw ... for example) anytime by running a ...
PokePuff05's user avatar

1
2 3 4 5
44