Questions tagged [cron]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
33 views

Cron to Bash Script to Bash Script to Expect Script

I want to execute a series of Expect scripts. The chain of execution goes like this: Cron job starts a bash script, this wrapper starts ~11 bash scripts in Parallel - each of them call an Expect ...
0
votes
0answers
18 views

I can check output of a command in shell script but I cannot do the same in crontab

I can run my script as .sh file in ubuntu shell but it does not work when it is called from cron job.I run my script into an ubuntu container (using docker) as if [ `java -jar /path/to/my.jar |grep -...
0
votes
0answers
11 views

How can I rebooting whes there hasn't been an ssh session in a while?

I have a Raspberry Pi with a problematic sshd. Periodically, it just starts refusing connections and will continue to do so until restarted. I could spend hours debugging that or I could just make a ...
2
votes
0answers
83 views

hourly cron job runs fine except at midnight

I have a cron job which is set to run hourly using 0 * * * *. The command is to run a postgres query and output to a file: 0 * * * * psql foo -f /home/foo/stats.sql >> /home/foo/stats.txt This ...
4
votes
1answer
362 views

Do scripts in /etc/cron.hourly and /etc/cron.daily, etc., get executed automatically?

I've understood that the entries in /etc/cron.d/ are executed automatically. But I have also found these in /etc/ /etc/cron.daily/ /etc/cron.hourly/ /etc/cron.monthly/ /etc/cron.weekly/ In /etc/cron....
0
votes
1answer
35 views

crontab and scp file transfer via script

I have a script that exports logs from log management server and send those exports to the archiver server. When I run this script manually, it complete it's task without any problem. It download ...
0
votes
1answer
32 views

bad hour errors in crontab file, can't install

I want my crontab to be every 4 hours but from a certain time 1 pm: I chose this config: 0 1/4 * * * but if I save I get the error: bad hour errors in crontab file, can't install. This following ...
0
votes
0answers
17 views

how to post cronjob output in terminal (Ubuntu) [duplicate]

I'm just a beginner with linux A have a simple test_script with echo "testtesttest" And a cronjob with * * * * * /home/<user>/test_sript and MAILTO="" to get this testmessage every minute. ...
0
votes
1answer
37 views

Python script runs manually but not in cronjob

So this is a super weird issue. I have a python script that calls many bash commands via subprocess.call based on certain criteria. Now, the script runs just fine manually but when thrown into a ...
1
vote
1answer
36 views

Command working in CLI but not in cron

I'm trying to set up a cron job via cPanel on a machine running CloudLinux/CentOS. The command should run a PHP script every minute to update stats; cd /home/account/public_html/phpredmin/public/ &...
0
votes
1answer
17 views

Cron is not logging stderr in /var/mail/user

I have this user who have a lot of cron jobs and I expected it to log stderr in its /var/mail/user. Sample below cron entry is working as expected in a different server. * 30 * * * * /usr/local/bin/...
0
votes
1answer
36 views

Cronjob fetching JSON with cURL. Check if response isn't empty before writing to file

I'm running Ubuntu and got a simple cronjob fetching a remote JSON-file and (over)writing it to the server. */15 * * * * /usr/bin/curl -m 120 -s https://path/to/remote/json.json > /store/json/here....
0
votes
0answers
25 views

Linux Crontab Segmentation Fault

For some reason, my crontab is giving me segmentation fault (core dumped) error when ever I attempt to access it using crontab -l or crontab -e. Everything is fine if I access the root crontab or ...
0
votes
2answers
608 views

Cron jobs have stopped working due to PAM

My cron jobs have stopped working on my CentOS 7 server. The server is running WHM/cPanel. It seems like it is an issue with PAM service because in /var/log/secure I can see the following errors when ...
0
votes
2answers
37 views

How to delete rogue cron job [duplicate]

Hello everyone, My machine has been hijacked by a bitcoin miner. he has a cron job that runs every 2 seconds. Using crontab -e to delete it doesn't work because it respawns soon after. ...
0
votes
0answers
12 views

Crontabing Scrumblr screenshot

for a monitoring purpose, once a week, I need to capture some Scrumblr board. So cron will be used. But how can I get a snapshot/screenshot for an URL ? This runs on CentOS release 6.3 (Final) ...
0
votes
1answer
49 views

Logrotate “permission denied” error

I am trying to get logrotate to work and keep getting the follow error message. /etc/cron.daily/logrotate: error: error accessing /ftp/logs: Permission denied error: error opening /ftp/logs/...
1
vote
2answers
51 views

Why is SHELL pointed to /bin/sh in a Csh script?

Yes, I know C-shell is bad. No, I did not choose C-shell. Yes, I would prefer to use a proper shell. No, I cannot switch to a better shell. I have a very simplistic script: /tmp/env_test.csh #!/...
1
vote
0answers
40 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 ...
0
votes
1answer
43 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
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 ...
1
vote
1answer
39 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 ...
0
votes
1answer
13 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
952 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 ...
0
votes
2answers
66 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. ...
2
votes
0answers
23 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-...
1
vote
0answers
28 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 ...
0
votes
1answer
10 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
30 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
vote
1answer
44 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
85 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
43 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
1k 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
46 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
18 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
36 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
149 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
56 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
328 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
55 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
77 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
60 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
55 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
64 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
25 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 ...