Questions tagged [cron]

Cron is a job scheduler that allows users to run commands periodically.

Filter by
Sorted by
Tagged with
1
vote
2answers
61 views

How check if a script is running? [duplicate]

I am using a custom script (stream.sh) which starts on boot. However, I want to check after every 5 minutes if the script is running. If it is not running, I want to run it again. How can I configure ...
0
votes
1answer
80 views

Prevent cron sending error messages

I have cron set to run a task for user pi (on my Raspberry Pi running Raspbian Stretch) every 15 minutes. 6,21,36,51 * * * * /usr/bin/mosquitto_sub -h Pi3Plus.local -v -C 1 -t weather >> ...
0
votes
1answer
33 views

Perpetually ping 3 devices from startup [duplicate]

I wish to ping three local devices, every 5 min, without stopping, from a Raspberry Pi running Raspbian OS. When my Pi powers on, I want that to automatically start. I saw an old post about it, ...
45
votes
6answers
48k views

cron ignores variables defined in “.bashrc” and “.bash_profile”

I have defined "SHELL" variable in /etc/crontab file: [martin@martin ~]$ grep SHELL /etc/crontab SHELL=/usr/local/bin/bash [martin@martin ~]$ file /usr/local/bin/bash /usr/local/bin/bash: ELF 32-bit ...
1
vote
2answers
228 views

Crontab not executing script that change background

I have this script to change the background and screensaver from my gnome desktop. Works fine when executing manually, but when I put it in cron it doesn't execute it. The file is executable. I added ...
0
votes
0answers
38 views

Crontab schedule <apt-get upgrade> [duplicate]

I'm using crontab to schedule the apt-get upgrade, the 'ldconfig' and start-stop-daemon' are missing. But when I upgrade in the terminal everything is fine. Any suggestions? this is my crontab script ...
0
votes
2answers
132 views

How to regularly update symbolic link (ln -sf) via crontab

Background The PNG image files I want to use is stored in directories according to date, for example: /NAS-mein/data/201812/ PNG stored within it like /NAS-mein/data/201812/foo/bar/20181231_1500....
0
votes
0answers
28 views

Unix Commands not working from Crontab [duplicate]

I have this command in a bash script called run.sh kill $(lsof -t -i:34445) On a terminal when i run this script using bash run.sh it works. However, i am using crontab to schedule this command. ...
3
votes
1answer
120 views

Unable to initialize environment variables on startup

I have written a python script that runs successfully on raspberry pi if it is run manually from the console. As I want to start the script on reboot, I've written a bash script to change directory, ...
0
votes
1answer
297 views

Why cron doesn't stop sending emails even redirecting to /dev/null

I have some cron tasks, and some of them doesn't stop sending me emails. An example task are: */2 * * * * php app/console mautic:email:fetch > /dev/null 2>&1 (All ...
0
votes
2answers
846 views

Monitor process and restart when not running using crontab

I have a Python / JS server combo that I need to keep running at all times. The Python server has a tendency to crash, as it's running on a server with 1GB of RAM. I've written a script called "...
4
votes
2answers
2k views

crond log level meaning

I cannot find anywhere the log level meaning of crond. I know that 0 is pretty much "log everything" while 8 is "show only important info" thanks to the crond help: / # crond --help BusyBox v1.26.2 (...
0
votes
1answer
27 views

Debian doesn't run cron after moving boot disk

I'm working on a bunch of custom scripts for Debian to run on an Odroid. My OS is on an SD card. Recently I needed to clone this SD card to another Odroid. I copied an image using Win32DiskImager on ...
1
vote
0answers
197 views

systemctl doesn't work from crontab

I'm trying to run a script calling systemctl from crontab but the command is not being executed. Other scripts work fine from crontab. The script works when executed in a terminal. This is the script:...
1
vote
1answer
84 views

Using cron.d in Arch

Till now I organized my non-crontab cron-jobs by cron.d in Debian-LAMP environment. My cron-jobs use me to upgrade CMSs containing my web applications. Here's how I do it from the beginning: #!/bin/...
-1
votes
2answers
97 views

Is there any disadvantage of making software update and upgrade automatic? [closed]

On Lubuntu 18.04, Software Updater notifies me there is update available from time to time. If I happen to have the time to, I will manually run sudo apt update; sudo apt upgrade. I am thinking about ...
1
vote
2answers
51 views

How to cancel anacron jobs delayed for a certain length of time?

Background: I want to backup some files on my laptop on a daily basis, and there are times when the laptop is shut down for several days in a row. I tried scheduling the backup as a cron job and ...
9
votes
1answer
13k views

Does a job scheduled in crontab run even when I log out?

I add some job in crontab file on a server. When I log out and the server is still on, will the job still run? Does it matter if I create a screen or tmux session and run some shell in it and detach ...
5
votes
2answers
508 views

Cron is trying (and failing) to open env file: /etc/environment

I'm using Devuan ASCII (which is more or less Debian 9, Stretch). Now, my /var/log/auth.log has a bunch of these entries: Jan 6 09:45:01 mybox CRON[20951]: pam_env(cron:session): Unable to open env ...
0
votes
1answer
64 views

Why would it not be a good idea to schedule a shutdown with cron?

In an answer to the question How to shutdown Linux at a specific datetime from terminal? a high-rep user provides two solutions: using at and using cron. The cron-based option says "this not a good ...
5
votes
2answers
377 views

Upgrading packages automatically

I'm am using servers (debian 7) and I'm currently running cron-apt to e-mail me when there are new upgrades available. Is the following command safe to run when new upgrades are shown? sudo apt-get ...
2
votes
1answer
5k views

Cron job not executing

I'm trying to use cron for the first time, and I'm stuck. I'm using Ubuntu 10.10, and the following is my /etc/crontab file. The only modification that I've made is appending the last line. I've ...
20
votes
5answers
150k views

How do I create a service for a shell script so I can start and stop it like a daemon?

I'm using CentOS 7 what my aim is to create a cron for every five seconds but as I researched we can use cron only for a minute so what I am doing now is I have created a shell file. hit.sh while ...
13
votes
3answers
36k views

Manually run a cron job / simulate running cron job? [duplicate]

I want to test if cron's mailing stuff after an executed task and things like that work. Is there a more elegant way to test this, then setting a cron job to run every few seconds? So, is there any ...
9
votes
3answers
2k views

How to recover deleted crontab

I was trying to edit crontab in the terminal, and I accidentally typed crontab -r instead of crontab -e. Who would figure such dangerous command would sit right next to the letter to edit the crontab? ...
2
votes
3answers
254 views

Why does cron use MTA to send emails, while we use MUA to send emails?

I have looked at the definitions of MTA, MUA, MDA, for example, https://ccm.net/contents/116-how-email-works-mta-mda-mua and https://en.wikipedia.org/wiki/Email_agent_(infrastructure) In Lubuntu, the ...
1
vote
1answer
48 views

crond won't start. Problem with temp directory /run/cron?

A week ago I updated my wife's computer, and after a few days noticed that crond wasn't running. Running crond -d wasn't much useful, so I ran strace crond -d`. This error appears: openat(AT_FDCWD, "/...
1
vote
2answers
391 views

How to make systemd timer run exactly every 10 minutes, with a task that lasts slightly longer than that?

I have a rather annoying issue with systemd timers and drifting start time. I had an old cron.d script (which executed faithfully once every 10 minutes) that I'm trying to modernize. The problem is ...
6
votes
3answers
7k views

How to delay a systemd unit until network is ready?

I've switched from cron to systemd-cron with my Debian unstable system, but now the daily "cron job" often fails, because it runs mixmaster which fetches its database from the Internet and if the cron-...
7
votes
4answers
13k views

Cron allowed special character “L” for “Last day of the month” on Debian

I'd like to know if L is one of the allowed special characters on Debian's cron implementation? I'm trying to set up a cron to run on the last day of every month. From the cron entry on wikipedia: ...
0
votes
1answer
523 views

notify-send with crontab in i3

I am trying to create a cron job that sends a notification via notify-send. I am currently trying this: */2 * * * * DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus /usr/bin/...
1
vote
1answer
44 views

Cronjob not executing, but command works

I have a server (Ubuntu 18.04) that is supposed to execute a Django management command at a certain interval. (every day at 16:30) I have setup jobs like this before, using cron but for some reason ...
0
votes
1answer
91 views

How to monitor cron maintenance scripts?

My home server runs a couple of shell scripts regularly for maintenance tasks - mostly backup, but also other stuff. I would like to be alerted in case anything fails but also keep a log of when it ...
12
votes
4answers
4k views

Run Script once a day with systemd

I want to run a backup script 10 minutes after booting up my machine but only once a day. Is it possible to build up such scenarios with systemd?
0
votes
1answer
71 views

execute sh script from crontab problem

I was configuring crontab with user "pi" to execute an sh script every 30 mins. In terminal:crontab -u pi -eI added this line: */30 * * * * /bin/sh /home/pi/test.sh And in the script test.sh there ...
0
votes
0answers
48 views

Incorrect timestamps in cron logs on CentOS 7 VM?

I need to see accurate timestamps for the cron logs of a CentOS 7 VM using an OpenVZ-based image. The machine also has SCL enabled because Red Hat supplies antique software out-of-the box. Users like ...
13
votes
8answers
81k views

How do I add an entry to my crontab?

I am using crontab for the first time. Want to write a few very simple test cron tasks, and run them. $crontab * * * * * echo "Hi" doesn't produce anything. crontab */1 * * * * echo "hi" says */1:...
0
votes
1answer
73 views

How to attach to an active session with a specific window and run a cronjob?

On my development setup I have an active session with multiple windows, I'd like to spit out the cronjob's output to this active session into a specific window . I wrote in the crontab the command: /...
1
vote
3answers
150 views

How to debug cronjob is not trigger in Linux Ubuntu?

I'm in Ubuntu linux. I just added this cron-job to run every minutes MAILTO="email@gmail.com" ...
0
votes
1answer
64 views

Cron jobs present in /etc/cron.* but no cron jobs for any user?

I'm trying to troubleshoot a cron failure on a CentOS 7 VM hosting a website and wiki. There's lot's of fodder on the web about troubleshooting cron, but I am having trouble understanding what I am ...
1
vote
1answer
91 views

What is logging in?

From https://unix.stackexchange.com/a/489913/674 Logging in is a user-space construct; the kernel doesn’t care about that. There are multiple examples of this; for example, cron jobs can run ...
2
votes
2answers
2k views

Cron Authentication Failure error in Linux?

I was bogged with an error “Authentication Failure” for all of my cron jobs in Linux Ubunutu. root@Test:~# tail -f /var/log/syslog | grep cron Dec 11 16:38:01 Test cron[14861]: Authentication failure ...
0
votes
1answer
813 views

Bash script able to run manually, but with cron not working. + Ubuntu 16.04

Env:- Ubuntu 18.04 I write one C program and trying to speak to port and fetch some data and dump into one file. Then I created one bash script and added this C program and expect to run at multiple ...
3
votes
1answer
144 views

find not working correctly in cron

We have a regular job on a server that creates some files in /tmp and doesn't delete them after it is done. For reasons I don't want to get into, we can't modify the job to delete the files. So I was ...
4
votes
2answers
667 views

Linux + files & folders cleanup under /tmp

On all my Red Hat Linux machines version 7.2 we saw that systemd-tmpfiles-clean.service is inactive: systemctl status systemd-tmpfiles-clean.service ● systemd-tmpfiles-clean.service - Cleanup of ...
2
votes
1answer
41 views

Possibility to disable or hide CRON notification about starting one specific process

I was wondering if it is possible to having multiple cron jobs in crontab active, but only one of them starts each minute. The problem here is I wish to keep log of all others jobs informations with ...
1
vote
1answer
207 views

how to manage cleaning of /tmp better on hadoop machines

As all know the content of /tmp should be deleted after some time. In my case we have machines ( redhat version 7.2 ) that are configured as following. As we can see the service that is triggered ...
0
votes
0answers
98 views

how to take affect the seting on temporary files ( /tmp )

subject - new settings retarding temporary files ( redhat 7.2 ) we set new values on the following configuration files , in order to minimize /tmp capacity in file: /lib/systemd/system/systemd-...
4
votes
3answers
9k views

Conditional crontab command in bash script

How do I invoke a crontab command so that I can schedule to run a script with a 20 minute delay based on some condition? Edit: What if I wanted a command that schedules a script to be executed only ...
0
votes
2answers
99 views

Problem with crontab

My script which starts a process and writes the PID of that process to file. This works as it's supposed to when I execute it from shell: process & echo $! > /home/xxx/PIDs/process.pid But ...