Questions tagged [cron]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
16 views

Compile in a single log all .log that shows Error message

I have many generated logs in /var/opt/log_loc1,/var/opt/log_loc2, /var/opt/log_loc3 from different cron jobs. Instead of looking in each log, is there a way to schedule a cron job that populates the ...
7
votes
3answers
204 views
+300

tracking crontab changes with git

I would like to use git to track changes in crontab. I have initialized a new git repository in /var/spool/cron/crontabs/ Now the problem is, when crontab is saved, the second line of the header ...
0
votes
1answer
32 views

Any way to quickly disable/renable cron jobs?

I currently have 50 cron scripting jobs created on crontab -e. These scripts check that various services are running. Sometimes when I'm testing the functionality of one service this requires me to ...
1
vote
1answer
36 views

Kali linux - Crontab @reboot is not executing

I'm on Kali Linux with VERSION_ID="2019.3" uname -a Linux kali 4.19.0-kali5-amd64 #1 SMP Debian 4.19.37-6kali1 (2019-07-22) x86_64 GNU/LINUX Trying to execute adjust_timezone.sh placed in /...
0
votes
2answers
21 views

Restart application after crash

I have some application (net core 2.1 app) which I run like this: nohup dotnet publish/TestApp.dll This application crashes sometimes, and I need to restart it when that happens. What do I need to ...
0
votes
1answer
11k views

Getting a Bad Hour Error in crontab

I am getting a Bad Hour error for the following crontab entry: */05 17-05 * * * wget -q -O /dev/null "http://abcd/cron/abcd" Is there any issue with this? I want the cron to run from evening 5 PM to ...
0
votes
1answer
27 views

Cron error: /bin/sh: 1: 6: not found [closed]

I want to run the Cron Job to do a very simple test. I wanted the command echo "hello" to be run from cron. However, everytime I run it I get the following error: Return-Path: <bitnami@ip-172-26-...
1
vote
0answers
25 views

reboot causes device to shutdown but doesn't start again for many hours after

I am using a BeagleBone running Debian. I have a cron entry in /etc/crontab which tells the device to reboot at 03:01 every night as follows 00 03 * * * root /sbin/shutdown -r +1 >> /...
0
votes
0answers
16 views

Linux booting hours after crontab reboot entry

I am using a BeagleBone running Debian. I have an entry in /etc/crontab as follows which tells the device to reboot every night / morning at 03:01 : 00 03 * * * root /sbin/shutdown -r +1 >&...
0
votes
1answer
31 views

CRON Job Schedule issues

I want to schedule a job for 3rd Friday of every month, 1 AM . I checked few cron entry websites for that didn't work for me. I was also checking for some awk options for this so far not successful ...
-2
votes
1answer
94 views

Is there a reason to use \+ or \- in date arguments?

I use date \+%F\-%T to show date and time in this format: 2019-08-15-21:34:58. From man date: %F full date; same as %Y-%m-%d %T time; same as %H:%M:%S I recognized no explanation for \+ or \...
0
votes
1answer
881 views

Bash script able to run manually, but with cron not working. + Ubuntu 16.04

Env:- Ubuntu 18.04 I write one C program and trying to speak to port and fetch some data and dump into one file. Then I created one bash script and added this C program and expect to run at multiple ...
0
votes
0answers
29 views

script runs under my user but fails under root and cron

Using some google and questions, I made this bash script if [[ $(curl --socks5 localhost:9050 --socks5-hostname localhost:9050 -s https://check.torproject.org/ | cat | grep -m 1 Congratulations | ...
28
votes
1answer
37k views

Why does cron silently fail to run sudo stuff in my script?

I have a script run from a non-privileged users' crontab that invokes some commands using sudo. Except it doesn't. The script runs fine but the sudo'ed commands silently fail. The script runs ...
-2
votes
2answers
26 views

How to tar all newly generated files in a directory every two hour and moving that tared files to another directory

files will generate every 5th minute in /kit directory.Want to tar all the files and move that files to /kit/bkp directory every 2 hr
62
votes
3answers
49k views

Recover cron jobs accidently removed with crontab -r

I entered crontab -r instead of crontab -e and all my cron jobs have been removed. What is the best way (or is there one) to recover those jobs?
-1
votes
0answers
9 views

Send the Cron.log file by Email [duplicate]

I have a cron job every 2 Hours that return servers status in a Cron.log file , how can I send this log automatically by email ? I have done this , but I don't receive anything , and a Dead.letter is ...
1
vote
1answer
34 views

Slurm on desktop computers, how to prioritize the owner

In short: On a Slurm cluster, I need some computers to be available and responsive to their respective owners during work hours. Problem: I manage a small (but growing) heterogeneous cluster with ...
-1
votes
0answers
8 views

logrotate for removing entries older than x days in y.log

How do I configure logrotate to look at (for example) /var/log/mail.log and remove any entries in that files older than 14 days? (Or is there a tool better than logrotate for this?)
0
votes
0answers
23 views

Awk problem in Cron VM.drop_caches=3 [duplicate]

I have some problem with the cleaning of the vm cache and AWK. I have one script who runs in cron.hourly (drop.cache) who said: sync; sysctl vm.drop_caches=3 The problem is for some reason the ...
0
votes
1answer
60 views

Sending Output of Script By mail

I have a script to Monitor servers in Production , and I want to receive the result of this script execution every 2 hours by mail , how can I do this ? someone has an example ? this is my Script: ...
0
votes
0answers
21 views

Awk and vm.drop_caches issue in cron hourly

I have some problem with the cleaning of the vm cache and AWK. I have one script who runs in cron.hourly (drop.cache) who said: sync; sysctl vm.drop_caches=3 The problem is for some reason the ...
-1
votes
1answer
41 views

tput in a cron job does not output bolded text [duplicate]

I comeback with a very strange behavior when we run this command on Linux redhat machine echo "$(tput bold)" start write to log "$(tput sgr0)" >> /tmp/log.txt we get ended bold text in /tmp/...
0
votes
2answers
36 views

My script doesn't run according to cron schedule

I have made (with a Stack Exchange help) a script that checks if the web application is available and restarts the web app daemon in order to get it running again (usually helps until I'm at work). It'...
1
vote
1answer
965 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 ...
10
votes
3answers
3k views

Schedule the last day of every month

I read from an instruction to schedule a script on the last day of the month: Note: The astute reader might be wondering just how you would be able to set a command to execute on the last day of ...
0
votes
0answers
40 views

Different output between command line and crontab

I'm trying to send an alert whenever a connection between 2 different machines gets lost. Basically I need to see from PC N°2 if there is an established connection from PC N°4 to port 6031 on PC N°5. ...
0
votes
1answer
871 views

Cron job not running on libreelec

So I am running libreelec and would like to run a script every time the pc boots and then every hour after. I have a command that launches the script in a screen and running it works fine. I have ...
0
votes
0answers
24 views

Can logrotate create missing files?

I was looking through the logrotate directives, and it seems that create will only create a new log file after rotation. I just get an error if the log file is missing. Is there a way to trigger ...
0
votes
1answer
5k 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 ...
0
votes
1answer
868 views

Where is NMon cron job for AIX?

While trying to know where is NMon job configured to run; I do find that it's NOT listed on Crontab (using crontab -l). BUT - the job is currently running as expected, which is weird. See the ...
1
vote
0answers
20 views

crontab: waitpid() failed waiting for PID xxx from “/usr/bin/sensible-editor”: No child processes

I have a problem similar to this one: after running crontab -e and exiting the editor (mcedit), the temp file is not saved, and the screen gets filled with a repeating error message: crontab: ...
0
votes
1answer
21 views

Cron logs show activity, but app logs show nothing

I'm trying to run a daily cron app. What I did: crontab -e Inside file, I have: 0 0 * * * cd /home/ec2-user/myapp && docker-compose up when I check /var/log/cron, I get: Jul 29 00:00:...
0
votes
0answers
12 views

How to temporarily suppress part of a monitoring task/event

I need to monitor a daemon every few minutes with a command and analyse both the exit code and the (multi-line) output. In case there is a problem I want to be notified one time, but I don't want to ...
0
votes
1answer
39 views

sed to remove leading comment on crontab with Sun Solaris 10

I am writing a sed command that should uncomment an entry in crontab on sun Solaris 10. I have tried 2 ways and they are working on Ubuntu but they didn't work on Sun Solaris 10; it returns sed: ...
1
vote
2answers
1k views

How to prevent text file creation by wget in cron job run?

I am using bellow to run a page every hour in my Virtualmin installed on CentOS 7 wget https://domain.tld/index.php?page=cron > /dev/null 2>&1 but it creates below files every hour when ...
0
votes
1answer
37 views

Shell script for crontab entries

i was asked to write shell script to perform the following task: update cronentry from \*/15 * * * * /bin/sh /opt/myscript/myscript.sh > /tmp/myscript.check.out to \*/30 2,4,6 * * * /bin/sh /...
0
votes
3answers
707 views

My backup is not working when started by Cron

For some reason, my backup is not working, when it is started by cron. Crontab entry 0 10 * * * /home/yzT/BackupDaily.sh BackupDaily.sh #!/bin/bash /home/yzT/Tools/FreeFileSync/FreeFileSync /home/...
0
votes
1answer
86 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/...
2
votes
0answers
34 views

User input in cronjob

I have created a script which calls another script.I'm implementing this via below cronjob 55 12 * * * cd /backup2 && ./script2.sh The another script ,I'm calling(restore1.sh) requires ...
0
votes
0answers
19 views

can't run sh script from crontab [duplicate]

my script: #!/bin/sh PATH=$PATH:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin if pgrep -x "firefox" >/dev/null then return else firefox & fi my crontab: * * * * * /home/...
0
votes
1answer
32 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
2answers
968 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 ...
1
vote
1answer
20 views

How to schedule a python script cron job that have packages in virtual environment?

I have my env where I installed all needed for me packages. And where I have my script that I want to put to the crontab. What I did, but there are a problem that when crontab running my script, of ...
1
vote
1answer
1k views

How to restart my server automatically using crontab if they went down?

I have a jar file which I am running like this in my Ubuntu 10.10 and then it starts my exhibitor server in the background - nohup java \ -jar /pekooz/exhibitor-1.5.1/lib/exhibitor-1.5.1-jar-with-...
0
votes
0answers
22 views

Cron Job (shell script) seems to work, but doesn't add anything to the log file like when I run it manually

#!/bin/bash # CHANGE THESE auth_email="user@example.com" auth_key="c2547eb745079dac9320b638f5e225cf483cc5cfdda41" # found in cloudflare account settings zone_name="example.com" record_name="www....
0
votes
1answer
52 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 ...
1
vote
1answer
1k views

Skip syslog/rsyslog logging of certain cron jobs

In most GNU/Linux distributions the default is to log start (and many different events) of every cron job to syslog. It's rather convenient, but not for a very frequent jobs, which started, say, every ...
0
votes
2answers
1k views

Run this PHP file via Cron Job

Here is the script: <?php //Create back files? define('CREATE_BACKUPS', FALSE); if (!is_dir($argv[1])) { echo "You must enter a valid path such as /home/apresv/public_html or apresv/...
0
votes
0answers
12 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 ...