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
6 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
17 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
29 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
vote
1answer
16 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/...
-1
votes
2answers
47 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
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
27 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 ...
1
vote
0answers
43 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 #!/...
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 ...
3
votes
2answers
308 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?
0
votes
2answers
73 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=...
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
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
0answers
37 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 ...
0
votes
0answers
11 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 ...
1
vote
0answers
112 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
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?
8
votes
3answers
852 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 ...
0
votes
2answers
60 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
17 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
votes
1answer
45 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
42 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 ...
1
vote
0answers
52 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
2answers
47 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
35 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
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
125 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
0
votes
1answer
22 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"...
3
votes
1answer
678 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 ...
1
vote
2answers
135 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 ...
1
vote
1answer
60 views

Why does this script output corrupt files when run automatically with crontab?

I have a script that scans a folder for all .mp3 files and creates an index. Next it waits 5s otherwise it doesn't work correctly. Lastly, it removes bad characters from the song names. I have this ...
0
votes
2answers
69 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 ...
1
vote
1answer
37 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
1answer
26 views

How to chedule a (long term) cron-task on a desktop?

Every crontab command require as mandatory the minute, hour and day fields. Now supposing I just want that a certain script or command should be executed once every 3 months on my desktop. AFAIK ...
0
votes
2answers
27 views

How to limit the email output from a Cron Job

I have setup a cron job from cpanel to email me daily so I know the site files have been backed up. However, it emails the entire file paths and the whole job. Snippet of the email output I receive; ...