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.

1
vote
0answers
22 views

Git add, commit, push from bash script

I'm trying to write a simple cron job that will keep my org-mode files in sync with a GitHub repo by committing every now and then. For some reason, it always manages to commit the files, but even ...
1
vote
1answer
51 views

Why does my every-minute crontab not work but same process on @reboot works fine?

I've been following carefully and reading a lot about setting up crontab with crontab -e any help is appreciated on this ... I have a process that runs on startup (reboot) that works perfectly, and ...
0
votes
1answer
41 views

Prevent cronjob's from writing to /var/mail/$USER?

In macOS, cronjobs configured with crontab have the command output and/or error messages (if the cron doesn't succeed) written to the /var/mail/$USER file. Can this be prevented? I've tried: * * * * *...
1
vote
1answer
23 views

Cron Job Console Connect and Root Permissions

I'm working on a script for user Bob with the relevant parts shown below. Problem I'm having is if I put this cronjob under user Bob, zenity will work but shutdown wont. And if I put it under root ...
28
votes
8answers
92k views

Why did my crontab not trigger?

I used crontab -e to add the following line to my crontab: * * * * * echo hi >> /home/myusername/test Yet, I don't see that the test file is written to. Is this a permission problem, or is ...
1
vote
1answer
898 views

Is there a way of seeing the CPU usage of the programs in crontab?

I have a 30+ scripts that are run by the crontab at certain intervals, varying from every 30 minutes to once a month. I would like to know if I can see how much drain they cause when they are running? ...
0
votes
2answers
1k views

Unix 11i v2 Script to detect new files within directory

I was hoping someone can point me in the right direction. I would like to create a script to check for new files (files with today's date) within a directory and then print the results to a text file. ...
0
votes
2answers
1k views

NTP issues on Nagios server

Our Nagios server NTP has isn't working right. First here is the issues: root@ccsd-lx-noc03 /var/log> tail -n 10000 messages | grep "NTP" Jul 5 16:19:36 ccsd-lx-noc03 nagios: SERVICE ALERT: ...
1
vote
1answer
1k views

a cron job to delete a specific file once it reaches more then 1gb size?

My server broke down with exenstive damages when a log file reached 27 gigs in a few hours. Log files are compressed daily, and are usually very small, maybe up to 10mb in 24 hours. Today there was an ...
2
votes
2answers
4k views

Default umask for cron jobs

How to set default umask for cron jobs, please? (On RHEL 6.) Jobs are started under non-interactive (obviously) no-login (?) shell. Not only I prefer dash over bash. But consider also bash called as /...
0
votes
1answer
12 views

CronJob command to delete multiple subdirectories by name in a given directory

I have two IP cameras which are sending image snapshots to an FTP server every 10 seconds, from 08:00 to 20:59. The directory structure looks like this: `-- public_html `-- securitycams |-...
9
votes
1answer
931 views

Is it possible to (7 day) schedule sleep time of a hard drive?

I'm looking for a way to schedule when an external hard drive connected to my Linux (Debian 9) box goes to sleep (stops spinning). To put this into content: I have a Linux box that runs as a ...
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 ...
7
votes
6answers
1k views

Detecting cron tasks run by another user

I am currently working through the Nebula challenges on exploit-exercises.com, and one of the challenges relies on a script being run by cron. This is run by another user (flag03) and the user I am ...
5
votes
3answers
4k views

Display cron job times in a human-friendly format

Is there a way to display or is there a tool that can parse a crontab expression and display it in a human-friendly way? 10 6 * * * sh /usr/local/crons/file_check.sh For example, for the above cron ...
0
votes
2answers
59 views

How should I run a cron command which has forever loop?

I have a script that have "while true" loop. And I want to run that script from cron on every minute, so that when the process is killed (or is failed - no matter why) cron will run the script again. ...
16
votes
4answers
82k views

Cron running job every 15 seconds

Could you advise me what to write in crontab so that it runs some job (for testing I will use /usr/bin/chromium-browser) every 15 seconds?
1
vote
1answer
1k views

Logrotate not picking up or acting on new configuration file

I had a logrotate configuration file set up for a log (let's call it Log1). It is working fine and the log is rotating everyday as expected. Yesterday I cloned this set up and modified it for three ...
3
votes
1answer
1k views

How do I allow crontab use for local accounts that don't allow interactive logins?

Ok, here's the situation (you're welcome for the earworm): I am running a multi-server RHEL 7 environment with SELinux enabled. Due to DoD STIG controls, I do not have root access, but I do have a ...
2
votes
0answers
19 views

How to start at boot a service that lives within a user's schroot?

Due to legacy (aka corporate) reasons, I have a number of servers running recent Debian versions (Debian 9, Debian 10) that also need to run older services such as MySQL 5.5. This is done via a (pre-...
2
votes
3answers
1k views

Cron only occasionally sends e-mail on output and errors

On Debian 8.1, I'm using a Bash feature to detect whether the stackoverflow.com website is reachable: (echo >/dev/tcp/stackoverflow.com/80) &>/dev/null || echo "stackoverflow unreachable" This is ...
1
vote
0answers
26 views

Rsnapshot log entries: “Number of hard links > 1”

I just noticed that my syslog is being spammed by rsnapshot, writing <host name> cron[1100]: (*system*rsnapshot) NUMBER OF HARD LINKS > 1 (/etc/cron.d/rsnapshot) every minute or two. It ...
2
votes
1answer
2k views

Managing cron jobs across multiple servers

We are facing a problem with managing cron jobs over multiple servers with dependencies. I hope there is an opensource central management project that I can be used to handle that and report the ...
0
votes
1answer
7 views

SMB Not Able to Use Date Command Substitution

smbclient //10.10.101.29/it -W WORKGROUP -U user --password pass -c 'put ./file_$(date +%Y_%m_%d).file ./folder/file_$(date +%Y_%m_%d).file' The above does not work & gives me an error stating: ....
0
votes
2answers
24 views

cron jobs printing to /dev/stdout

I want to setup a job that prints output to /dev/stdout, but cron is intercepting it, and sends an e-mail instead crontab -l */1 * * * * echo "hiccup" >> /dev/stdout 2>&1 this is the ...
0
votes
0answers
32 views

How to run script via cron and get same results as terminal? (Centos 7.2)

I have a complicated question (I understood that's related to environment variables). I'm running a script via termial as follows: "bash install_version.sh" script contains: #!/bin/bash /root/...
-1
votes
2answers
60 views

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

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 ...
1
vote
1answer
28 views

cronjob [ -x /usr/lib/php5/sessionclean ] returns command not found

I'm running PHP 5.6 on an Debian 8 machine and hence there is a cronjob running as root for cleaning up session data: 09,39 * * * * root [ -x /usr/lib/php5/sessionclean ] && /usr/lib/php5/...
4
votes
3answers
33k 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
11 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
34 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
231 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=$...
44
votes
2answers
104k 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
889 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
38 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
17 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 ...
0
votes
1answer
30 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
134 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
48 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
134 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
322 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
45 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?
105
votes
6answers
84k 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
76 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
58 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
49 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 ...