Questions tagged [cron]

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

Filter by
Sorted by
Tagged with
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
41 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
884 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
27 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
875 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
29 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
23 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
42 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
40 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
719 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
108 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
40 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
21 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
33 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
1k 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
33 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
23 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
57 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 ...
0
votes
2answers
1k views

still getting Removing leading `/' from member names with tar -C option from cron email

I am trying to get rid of the "Removing leading" messages from a cron that runs a backup job with tar. The emails still have these messages, and I'm using cronic to only send emails when there are ...
0
votes
1answer
58 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 ...
2
votes
0answers
94 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 ...
0
votes
2answers
2k views

Cron tab to run a java file

I'm having issues getting a cron tab to run a java file every 5 minutes. I have tried to create an executable script to see if that is what's needed: My script and java file are both stored in /usr/...
4
votes
1answer
460 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....
30
votes
10answers
85k 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
949 views

Crontab with NodeJS

My Crontab doesn't work with a NodeJS script. My crontab using sudo crontab -e : 0 0 * * * /usr/local/bin/node /var/www/myproject/index.js However, it works using these commands : cd /var/www/...
1
vote
1answer
39 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
73 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
18 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. ...
2
votes
2answers
3k views

Cron job gives no output

I tried to schedule my first cron job as follows: crontab -e The file had some comments at the top, and on the first line after those, I put * * * * * date I expected the date and time to be ...
0
votes
1answer
111 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 ...
0
votes
1answer
2k views

Crontab to reboot nightly and start shell script

I have the following command that runs a shell script that launches several python scripts for me on reboot: @reboot sh /home/pi/repos/launcher.sh >/home/pi/logs/cronlog 2>&1 I want to ...
1
vote
1answer
1k views

Crontab and Tmux not playing well together

So I want my server to run a script which starts several tmux sessions on boot. This is my crontab: @reboot . /home/steven/.profile; /home/steven/Scripts/Start.sh And this is the content of my ...
0
votes
4answers
1k views

crontab is launching multiple java process every 5 minutes?

I have a java runnable jar which I need to run it if it not running or got killed for some reason so I decided to use crontab for this - I need to run the crontab as "poppetapp" user so I am logged ...
0
votes
1answer
116 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
1answer
19 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
1k views

cronjob bash script called within another shell script not working

I have a shell script which calls a bash script within it. when I run this shell script manually it works fine however when I schedule this thru cronjob, the bash script is not doing the intended job. ...
5
votes
4answers
36k views

Crontab error: no crontab For [user]

I'm seeing an error every time I do the command below. Why? $crontab -l no crontab for server where server is the user account. This issue comes about because the script in crontab doesn't work, so ...
0
votes
0answers
64 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
118 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. ...
1
vote
2answers
519 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, ...
0
votes
0answers
15 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) ...
1
vote
2answers
78 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
1answer
1k views

Output print statement in python does not goes into cron log

my crontab looks like this: @reboot sh /home/pi/LCDinterface/shutdownlauncher.sh 2>&1 | tee -a /home/cronlog Content of shutdownlauncher.sh : cd / cd home/pi/LCDinterface date python ...