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
2answers
708 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 ...
1
vote
0answers
23 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/...
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
297k 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
12 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
704 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
148 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
56 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 ...
7
votes
3answers
827 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
41 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
52 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 ...
0
votes
0answers
16 views

CRON running job not in my user's crontab file

You read that right. It's the opposite of everyone's issue. I'm on a Pi 3 w/ Raspian I have a cronjob that is running once when it is supposed to (9am, 0 9 * * *) and is running rogue again at 5:...
0
votes
2answers
30 views

Cron task won't run, although all is correctly set up

This cron tqsk doesn't work: [main_usr@localhost ~]$ sudo crontab -l -u root 0 * * * * /home/main_usr/cron_test1.sh > /home/main_usr/cron_test1_out.sh.out 2>&1 [main_usr@localhost ~]$ ...
1
vote
1answer
50 views

How to automatically start Rescuetime on startup (tried crontab and rc.local)

I have installed rescuetime on debian 9. It requires the command rescuetime to be run in a terminal, this just keeps running rather than running and closing (it adds an icon into the tray at the ...
-1
votes
1answer
39 views

How to make secure backup in Ubuntu Linux

I tried to understand the code but I have some difficulties in it. crontab -e is crontab schedule formatpm 9pm at night every Sunday, but it seem to me it is encrypted.  Can any one explain it? ...
0
votes
0answers
37 views

Run and close a file every few minutes

I need to play an audio file and after 3 minutes close it, then all over again. play it 3 minutes and close it. Currently I'm using a cron job to open the file in VLC and close it, but it's not good ...
0
votes
0answers
19 views

crontab daily backup [duplicate]

I want to use following command to back up my crontab on daily basis: crontab -l >/var/BackUpSource/crontab/crontab-$(date +%Y-%m-%d_%H:%M) It works perfectly in console. But when I try to set it ...
0
votes
1answer
1k views

cron job to run under conda virtual environment

I have a Anaconda Python Virtual Environment set up and if I run my project while that virutal environment is activated everything runs great. But I have a cronjob configured to run it every hour. I ...
9
votes
2answers
23k views

System Crontab or Root Crontab

System crontab: /etc/crontab Root crontab: sudo crontab -u root -e Which way is preferred? As they all run tasks within administration privilege.
1
vote
1answer
862 views

CentOS machine keeps “losing” active directory membership

All of our CentOS 6 machines have been joined to our active directory domain. Each of these machines eventually "loses" their domain membership, which breaks authentication for AD users. I created a ...
0
votes
2answers
103 views

Local variables in Bash script to be run by Cron

I have a bash script which loops through a list of filenames in a text file, deduces a date from the filename and then calls a library script (./dropbox_uploader.sh delete [filname]) to conditionally ...
1
vote
1answer
2k views

Cronjob is running every minute but not at a specific time

The job works if set like this: */1 * * * * /usr/bin/php /home/test/cron/test.php And if set to something like: 15 20 * * * /usr/bin/php /home/test/cron/test.php it's not working. [root@localhost ...
19
votes
3answers
20k 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 * * *
1
vote
6answers
182 views

Trigger an action when an URL has been visited

Let's say I send an email, containing a link to my website, to someone that I really hope he'll visit it (fingers-crossed style): http://www.example.com/?utm_source=email392 or http://www.example....
30
votes
12answers
18k views

Using notify-send with cron

I am using Arch Linux with KDE/Awesome WM. I am trying to get notify-send to work with cron. I have tried setting DISPLAY/XAUTHORITY variables, and running notify-send with "sudo -u", all without ...
26
votes
10answers
79k 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 ...
1
vote
1answer
2k views

Trying to create a cron to Rsync then tar the folder

I'm stuck at the first hurdle! I want to run a couple of commands from a bash script. First something like this to rsync some directories: rsync -e ssh -az user-whatever@website.com:/home /location/...
0
votes
1answer
78 views

How to check the version of cron that is running?

how can I check which version of Cron is currently installed and running on my host? I can't seem to find a command that will allow to me see which version is running. They all seem to just show ...
0
votes
2answers
73 views

Allow null password for file transfer from Sunsolaris machine to linux mchine?

I m trying to pull a file from a Solaris server to my Linux server and I did it successfully by using scp.I want to run this below command as a cronjob, How can I save password for this automation ...
10
votes
5answers
6k 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
1answer
40 views

crontab(1), crontab(5) what's the difference? [duplicate]

I want to learn how to use crontab. I see there are two manual pages: crontab(1) crontab(5) Why are there 2 manual pages? What are the differences between them? Do I need to study both in order to ...
0
votes
2answers
39 views

Cron log shows shell script has run but it really hasn't

I'm trying to setup a relatively short shell script called backup_extract.sh which will essentially unzip a zip file, drop a database, create a database of the same name, then import an sql file that ...
0
votes
1answer
48 views

How can I open a shell in the environment that cron (alternatively launchd) uses to execute commands?

I am trying to get launchd (which is macOS's alternative for cron) to run a job for me. It doesn't work, while running the commands on a bash launched with sudo does. I tried redirecting the output to ...
1
vote
0answers
36 views

install job on crontab

I definitely sure that the syntax I am using in the crontab file is correct because I installed the same job on another host and it is working fine. The syntax is: 05 10 * * mon,wed,fri /app/aban/...
0
votes
1answer
31 views

X11 and pygame in Crontab

I have a script very similar to the one at the end of the pygame example page, and I want to run it on startup to make the whole thing listen for commands on startup. I ran "crontab -e" and as a first ...
0
votes
0answers
17 views

It seems that my cron task doesn't run [duplicate]

I have cron task for root that should run daily: $ whoami main_usr $ sudo crontab -l -u root 0 23 * * * certbot renew --cert-name app.my_domain123.com --pre-hook "systemctl nginx stop" --post-hook ...
0
votes
2answers
985 views

Netcat as Daemon

I'm trying to set up something that telnets into a device and saves the output to file. I can get it working on the CLI, but not running it at boot (using crontab) This works running running on the ...
1
vote
1answer
36 views

Modify subject line of cronjob

I have the following one-line cron command set up which gives me a nice simple message in the body of the email upon backup complete (thanks to @steeldriver). tar -cpzf /home/user/backups/...
0
votes
0answers
25 views

Is it possible to set at or cron job at logon event? [duplicate]

Is it possible to write an at or cron job script that will execute on a particular user's logon? If so, what will be the method?
0
votes
1answer
19 views

Add log filename with minus 3 day in crontab

I want to set my log file name into crontab with date - day, not current_date. I've already success for current date like this: 00 02 * * * bash run_myscript.sh > /logs_myscript_`date "+\%Y\%m\%d"...
0
votes
1answer
47 views

“sudo shutdown now” in my crontab @reboot

Now whenever my EC2 instance starts, it shuts down immediately, anyway to salvage this situation? OS: Ubuntu18.04
1
vote
2answers
75 views

Schedule python script every day, between certain hours, every X minutes

I have a python script on my RaspberryPi that I want to run at these general times: Weekdays, after 4:30 PM until 00:00 running every 30 minutes Weekends, after 8:00 AM until 00:00, running every 60 ...
0
votes
1answer
4k views

Crontab in docker container

Hi I'm trying to run a cron job in a docker container. So I have added that in my Dockerfile My Dockerfile FROM nginx:stable RUN apt-get update -y && apt-get upgrade -y && apt-get ...
3
votes
1answer
613 views

When are “cron.monthly” cron jobs run?

I want to run yum updates on a monthly basis which is actually running daily now. Can I move 0yum-cron from cron.daily to cron.monthly? If yes, then how can we know which time and day of the month ...
0
votes
2answers
53 views

Monitor process pid for change

I have a service that is always supposed to be running. I’d like to know when the service ever stops or gets restarted. I’ve thought about referencing the service’s PID. If it gets restarted, it ...