Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [cron]

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

0
votes
1answer
21 views

Is it possible to recover a deleted file from crontab -r?

I made a very serious mistake. I was editing the crontab file of my remote server, I was as the root user and it turns out that I wrote crontab -r instead of crontab -e and without previous notice it ...
4
votes
3answers
32k views

Crontab error: no crontab For [user]

I'm seeing an error every time I do the command below. Why? $crontab -l no crontab for server where server is the user account. This issue comes about because the script in crontab doesn't work, so ...
1
vote
0answers
10 views

How to implement a worker system using only Cron?

I have a PHP web application with a particularly slow endpoint and I have diagnosed that this is being caused by a complicated function call. It is not essential that the function call is completed ...
2
votes
2answers
26 views

How to set cron job for every 5 hours

Can I use below code to set cron job for every 5 hours? 0 */5 * * * script.sh What time my script.sh will be executed? 0000, 0500, 1000, 1500, 2000, 0100, 0600, 1100, 1600, 2100 and so on... OR ...
5
votes
2answers
7k views

How to build a cron docker image properly?

I am trying to build a Debian-based image to dockerize a cron process, but my cron jobs are never started. Here is my Dockerfile: FROM debian:jessie RUN apt-get update && apt-get install -y --...
0
votes
2answers
218 views

cron job not running - root runs ok tho

I have a script I just created which runs fine under root. I added a cron job but it doesn't run right Commands are: gpio -g mode 17 input getval="$(gpio read 17)" todayis=$(date) getstatus=$...
43
votes
2answers
102k views

Location of the crontab file

as many (most?) others, I edit my crontab via crontab -e, where I keep all routine operations such as incremental backup, ntpdate, various rsync operations, as well as making my desktop background ...
1
vote
0answers
41 views

CRON (no tty): Delete message with specific “Message-Id”

I have a situation where I need to delete from mailbox (eg. /var/mail/root) messages with specific Message-Id. Following code works only from console, but I have to do it without user interaction ...
1
vote
1answer
34 views

How do I confirm a file sync has completed before executing a command?

I have a computer periodically syncing folders of content with another computer using Resilio Sync. The receiving computer has a sorting process on an hourly cron, which analyses the folders and their ...
0
votes
0answers
16 views

Automatically upload directory to dropbox in no time (whenever any changes done to that directory

I installed the following Script on my CentOS 7 terminal access. I'll use this script to upload specific directory from the Linux to dropbox. using the following command i can upload the directory ...
-1
votes
0answers
26 views

cron: list jobs run and to run with times - is that possible?

I've seen a lot of questions around listing cron jobs, a really good one here: How can get a list of all scheduled cron jobs on my machine? but what puzzles me still, and seems impossible, though I'...
0
votes
1answer
20 views

Logging all crontab output using MAILTO

I've been trying to get all cron job outputs to a file (not email). The alias is set in /etc/aliases. logthecron: "|cronlog.sh" And in crontab MAILTO=logthecron. The cronlog.sh file writes to ...
-2
votes
1answer
40 views

Is it possible to make a crontab using daemon?

We were asked to make a whole cron stuff, not making the cron job but the actual cron that will work with the date/time that we input to them.
3
votes
2answers
123 views

specify a time interval in which to execute a certain script

I have this bash script: while [[ 1 ]] ; do sleep 3600 ; ./notify.sh --text "ricordati di bere" && play /mnt/musica/login.wav && zenity --info --text="<span size=\"xx-large\">...
1
vote
1answer
41 views

Is there a systemd alternative to user specified crontabs?

I notice that on Debian related systems, system level crontab scripts in /etc/cron.hourly, /etc/cron.daily... are being gradually decommissioned in favour of systemd timers. Eg: $ cat logrotate #!/...
1
vote
0answers
107 views

Why does this rsync command running in a cron fail?

Why does this rsync command running in a cron fail and how to debug it and fix? unset SSH_AUTH_SOCK && unset KRB5CCNAME && rsync -hvru -e "ssh -p 34503 -i /root/.ssh/...
0
votes
0answers
22 views

No value for $TERM and no -T specified crontab exec [duplicate]

I have a bash script which simply activate a python virtualenv and execute a python script. #!/bin/bash . /usr/local/bin/utils.sh . /home/fold/.bash_profile set -eu -o pipefail script_name=main_ETL ...
0
votes
1answer
3k views

Cron stopped logging to /var/log/cron.log

A month ago I set cron to log to /var/log/cron.log by modifying /etc/rsyslog.d/50-default.conf. Logging worked great until I changed permissions on /var/log (by easing permission restrictions), and ...
3
votes
2answers
306 views

Setup Cron to pkill -f

I have a script that runs in a loop. I can manually start the script from the command line easily enough with ./run_my_script but occasionally the script locks up and just needs a restart. So I ctrl-c ...
-3
votes
1answer
41 views

How to send a mail for every 10 minutes through shell script?

I am in the need of a script which can send the mail for every 'n' minutes automatically through the shell script? How to do it?
104
votes
6answers
82k views

How can I execute `date` inside of a cron tab job?

I want to create a log file for a cron script that has the current hour in the log file name. This is the command I tried to use: 0 * * * * echo hello >> ~/cron-logs/hourly/test`date "+%d"`.log ...
0
votes
2answers
72 views

Cronjob does not run at 1am

Problem I have a script to be run at 1:32 am, so I set a cronjob by $ crontab -e And in the editting file, I have 32 1 * * * /home/user/.scripts/midnightjobs where "user" is my user name. However,...
1
vote
2answers
55 views

How to list all files less than 1080p

There are a number of Youtube channels that I archive using a daily cron script that runs youtube-dl. However, in checking over the videos to make sure my script is working, I noticed for one of the ...
0
votes
1answer
48 views

How do I use Crontab to open a file at Linux startup only on a specific date?

matthew@matthew-pc:~$ crontab -l [...] @reboot 1 5 * sleep 10s && export DISPLAY=:0 && xdg-open ~/@/Testing.jpg "Testing.jpg" was not opened at Linux startup on May 1. How can I use ...
0
votes
1answer
26 views

Cannot edit crontab from service

I'd like to schedule a daily autoshutdown via sudo service autoshutdown start or either abort it via sudo service autoshutdown stop. /etc/systemd/system/autoshutdown.service [Unit] Description=...
6
votes
4answers
22k views

List currently running cron tab and stop it

I created a cronjob, it runs for a very long time but now don't know how to stop it.
1
vote
2answers
2k views

Not able to schedule tasks in crontab

[srinkann@sjc-ads-440 ~]$ crontab -e no crontab for srinkann - using an empty one /bin/sh: /usr/bin/vi: No such file or directory crontab: "/usr/bin/vi" exited with status 127 [srinkann@sjc-ads-440 ~]$...
0
votes
0answers
23 views

Work out a cron job schedule

I have a set of 6 jobs to be run via cron. Let's call them jobs A,B,C,D,E & F 'A' & 'B' take 2 mins to complete, 'C' , 'D' , 'E' & 'F' take 3 min each to complete. No job is dependent on ...
1
vote
2answers
3k views

I cannot kill crond - trying to stop cron service

This is frustrating, I try: service crond status And get this: Redirecting to /bin/systemctl status crond.service crond.service - Command Scheduler Loaded: loaded (/usr/lib/systemd/system/crond....
3
votes
3answers
548 views

Executing 'ssh-add -D' from a cron job doesn't work

I've set up an openSSH server on an ubuntu-server machine, and I configured it to use public/private key (without password). I want to require both password and key check when the client connects to ...
1
vote
0answers
23 views

Redirecting input from cron job [duplicate]

I'm using a plugin manager for vim (vim-plug), and have a cron job to perform updates: vim +PlugUpgrade +qall &>/dev/null; vim +PlugUpdate +qall &>/dev/null This job occasionally ...
3
votes
4answers
15k views

@hourly vs 0 * * * * - Cron - How to run jobs hourly, but at different times

I have jobs that I want to run hourly, but not necessarily at the same time, which I think 0 * * * * job Means run at the 0 minute of every hour on the dot. I know I can also use @hourly job ...
3
votes
0answers
36 views

How to deny crontab to group

I'm trying to deny crontab to group but I had no success so far. Nor I saw how to do it, or even discussions about it. Is it possible to deny crontab to groups instead of users? Imagine if you have ...
-1
votes
2answers
6k views

Cron job is not working [closed]

I have a cron job configured at var/spool/cron/testuser, Am calling adindex.sh file from there. Am getting results when am directly put the command directly in prompt(php and sh), But cron is not ...
0
votes
0answers
10 views

Cron and etherwake on Raspbian

I wrote small app which runs etherwake. From bash it works fine and wakes up another PC. But if it is launched from crontab, then nothing happens. Has anyone encountered a similar problem and how to ...
0
votes
2answers
737 views

Crontab Entries in Linux Server getting deleted automatically everyday

Crontab Entries in my Linux is getting deleted everyday. I added the entries and on the next day when I check all I could find is: */60 * * * * curl https://ooo.0o0.ooo/2017/01/21/58837a6d11262.jpg -...
-5
votes
2answers
843 views

Who can use cron? Who is using cron? [closed]

I want to run cron every minute OR hour xclock.
1
vote
1answer
2k views

Run python code from cron in an Anaconda environment

I need to run a python script using a specific anaconda environment, since I need to execute this script several times per day I would like to do it using the linux crontab file (/etc/crontab). When ...
2
votes
3answers
10k views

Null message body; hope that's ok

I have the following command below as part of a cronjob. When I run the command via cron or at the command line, I get Null message body; hope that's ok. The contents of the email are empty but when ...
61
votes
7answers
301k views

crontab's @reboot only works for root?

man 5 crontab is pretty clear on how to use crontab to run a script on boot: These special time specification "nicknames" are supported, which replace the 5 initial time and date fields, and ...
0
votes
0answers
14 views

Making appointments in Calcurse without using interactive CLI interface

I'd like to make a automated script so I could enter some repeating events in Calcurse. Is there a way to do this without using the interactive interface?
2
votes
4answers
713 views

About executing a python program in a shell script which is scheduled on crontab

I have a problem with regards to crontab. I have a script named checker.sh and I want to schedule it so that would run every minute: * * * * * sh /home/pi/checker.sh I have the script here: The ...
12
votes
4answers
38k views

cronjob for automatic DB backup to date prefixed file

I am using the latest Linux Mint. I was wondering if it's possible to create a special cronjob for a database backup. In my /etc/cronjob file I have the following code: # Minute Hour Day of ...
1
vote
1answer
3k views

auto restart Apache when high load average

My server always shut down when it reach a high load average. I have optimized my Apache, MySQL. But I cannot prevent sometime in a heavy traffic. So I try to write some shell to control load average. ...
3
votes
1answer
151 views

How to one way sync two folders on startup

I am trying to synchronize: /var/www/CI_MAIN/ according to the changes made in: /home/coco/workspace/CI_MAIN/ (PDT's workspace). To do this, I entered sudo crontab -e in the command line, ...
0
votes
1answer
57 views

Script for backup each DB on server but omit system databases

I have read a lot of post around this topic but I didn't found the one to fit my needs. So, basically I want to make two backups: one at mid day (12 PM) and the other at midnight (12 AM) for each ...
2
votes
2answers
4k views

How to use exit status in crontab

I add the following script line to the red-hat crontab, script should run on Saturday in 5:00 in the morning. In order to run the script /var/scripts/PLW.pl every Saturday at 05:00 morning. I want to ...
8
votes
3answers
850 views

Echoing a tail command produces unexpected output?

This command, when run alone, produces the expected result (the last line of the crontab): tail -n 1 /etc/crontab However, when I run it as part of an echo command to send the result to a file, it ...
1
vote
1answer
42 views

Having trouble with cron

I have an Intel NUC with Ubuntu installed. It runs a Minecraft server. I wanted a simple backup system for the server, and through some Googling I found that I can do so using cron and tar. However, I ...
0
votes
2answers
58 views

What should I do to run a script on specific time without cron?

I want to run a script without using cron at specific time. But it is not working. #!/bin/sh DATE=`date | cut -d' ' -f4` #Date is getting printed, if I run it manually, without any error. But file ...