Stack Exchange Network

Stack Exchange network consists of 174 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
19 views

Service command not found cron

I need to start the icecast2 service on startup. To to make it run on boot, I added to crontab (root) the following line: @reboot service icecast2 start >/home/pi/logs/icecast2.log 2>&1 ...
1
vote
1answer
21 views

detecting cli script execution and not cronjob script execution

Is there a way to detect if i run a shell script by hand in the console or if the cron starts the script (e.g. using crontab) ? Edit: Usage example: manualy i want to show a progress bar for ...
0
votes
1answer
16 views

How to set cronjob or unit file to run after reboot

I have created cronjob as @reboot root sleep 75 && firefox but then I test it, but it didn't work. In /var/spool/mail/root it shows me this what I want to archive is after every reboot I ...
0
votes
2answers
17 views

Run Makefile through Crontab

I am new in linux and scripting. I have a script that runs make fine from terminal but throws error when I am running through Cronjob. The script in ypxfr.sc: #!/bin/sh make -f /var/yp/Makefile -C ...
0
votes
0answers
31 views

Wrap a cron job around a script which queries MySQL tables on host [on hold]

I have an input.sh script which basically connect to mysql-db and query multiple tables to write back the output to the output1.out file in a directory. I would like to pass an integer (unique_id in ...
0
votes
2answers
17 views

python script doesn't appear to be executed but no errors show

I have a python script that I would like to run through cron every minute * * * * * /usr/bin/python3 /home/analytics/Documents/devDeliverables/attendanceReadTsv/check_raw.py when I run this using a ...
0
votes
0answers
27 views

Unable to restart network-manager from a script when run as a cron job

I have Ubuntu 18.04 and sometimes (some wifi connections) my network just stops working. What I have been doing so far is when that happens I just restart network-manager and it starts working fine ...
3
votes
1answer
122 views

Scheduled folder backup

I'm looking for how to automatically backup a user's home directory in CentOs 7 to a remote host or NAS or just to ~/.snapshot. In some Linux setups, I have seen a .snapshot folder in the user's home ...
0
votes
1answer
37 views

Python script runs as bash command on terminal but not as a cron job

I am trying to run a python script on my Raspberry Pi (Stretch OS) as a cron job but the script fails to run fully. On crontab -e, it reads like this: */1 * * * * python /home/pi/project/myfile.py &...
0
votes
0answers
38 views

Command works on cli, but not on crontab

I have script that is doing an iperf3 test against a server and is piping it into a file. Then I have this command, that takes makes a line for a logfile. It works when executing on the command line, ...
-2
votes
2answers
51 views

Python file fail on a crontab job [closed]

I'm using RPI zerow to run a python code (Raspbian Strech-Lite). I need to run 2 file during startup: MQTTlogger.py and Sched_MQTT.py. Both files run OK using command line, but when I added 2 job on ...
1
vote
2answers
61 views

Crontab not working or script error?

I got stuck with this cronjob that just won't work. I left it for a day to troubleshoot it again with some fresh idea's but still no luck. I tried to find my answer on this great post, but not ...
1
vote
1answer
30 views

cron not executing command with variable

I have some logic for executing java projects; it all works in the terminal console when I type it, but not in the cron scheduler: run 1st microservice and get variable from POST request: java -jar /...
0
votes
1answer
34 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 ...
2
votes
1answer
42 views

How to Specify Group Owner During Cron

I've done a fair amount of research but either I'm having trouble formulating the context to create relevant results or the information is hard to find. I have a production ubuntu 16.04 server ...
1
vote
1answer
30 views

What can be reason for getting “execute permission denied” in cronjob in UNIX?

I have a shellscript which can be successfully executed in UNIX with command sh Shell_script.sh; but I want it to run automatically. So I just configured a cronjob to run the script using crontab -e. ...
2
votes
3answers
51 views

is it ok to run cron job with the same time?

we want to delete all files of the following job with the same time on midnight 0 0 * * * root [[ -d /var/log/ambari-metrics-collector ]] && find /var/log/ambari-metrics-collector -type f ...
0
votes
2answers
41 views

cron job not redirect the output to file [duplicate]

I set the following line in cron job under /etc/cron.d/find_old_file * * * * * root [[ -d /var/log/ambari-metrics-collector ]] && find /var/log/ambari-metrics-collector -type f -mtime +10 ...
2
votes
1answer
47 views

How to validate the syntax in cron job [closed]

We are creating a new cron job under /etc/cron.d. This cron job has around 56 lines, and all commands should be executed at the start of each month. I am looking for suggestions to validate the ...
2
votes
1answer
37 views

cron script cannot find logwatch and chkrootkit

I have an issue that has probably something to do with the PATH variable. This is a email I got with error about a script running in cron: Cron Daemon <mail.org> 05:08 (15 hours ago) ...
0
votes
0answers
42 views

Crontab is deleting my jobs or reverting to a previous state?

I have found a similar problem (Crontab resetting itself) but it does not provide much insight. I am new to using crontab and am having the same problem with my crontab be reverted to a previous state ...
0
votes
1answer
20 views

Is it possible to setup a ffmpeg cron job for a directory?

I need a way to automatically convert gif files to mp4. And set a directory and check for new files every 5min. Id like to use ffmpeg for the coverting and delete the gif after. ffmpeg -f gif -i cat....
0
votes
1answer
48 views

Cronjob won't run properly

I have this sh script: ufw allow 27017 && iptables -F in a file test.sh And I want to run this with a cronjob with root each day at 07:00 like this: 0 7 * * * /root/cron/test.sh And I ...
0
votes
1answer
54 views

Sort .bash_history content alphabetically

I'm using HISTIGNORE to ignore the most used commands and HISTCONTROL=ignoreboth:erasedups to remove duplicates. Is there a way to periodically sort the contents of the .bash_history in alphabetical ...
0
votes
1answer
36 views

Tar crontab not working, while command works on it's own [duplicate]

I have this crontab * * * * * tar -czf /backup/$(date +%F--%T)-localusers.tgz /vagrant It does not work. But if I do tar -czf /backup/$(date +%F--%T)-localusers.tgz /vagrant/ It works. Anybody ...
0
votes
1answer
55 views

bash script output not written to file in folder

My goal is to run a script in crontab and save its output (via echo commands) to a log file. Thus, I am using the following: $HOME/folder/sh/script.sh 1>$HOME/folder/logs/script.log 2>$HOME/...
1
vote
1answer
27 views

Shell_exec of dynamically created script with else

I am trying to use Shell_exec to a run a script which is dynamically created and stored in a php variable. Here is the script so far. { curl -fsS --retry 3 https://hc-ping.com/same-unique-id-here ; \...
0
votes
1answer
16 views

changes to /etc/mail.rc does not seem to take effect

there were some changes with our smtps server, specifically the port that we can use. as I have done before, I changed the details in /etc/mail.rc file. but when I run my script, there is a log in /...
0
votes
1answer
14 views

local mail setup to debug root cron jobs on debian

I'm running the following setup: beaglebone black [wireless version - 4.9.82-ti-r102 #1 SMP PREEMPT] -- running debian 9.3 stretch. I've attempted to install the latest postfix mail server -- just so ...
1
vote
2answers
49 views

How can I use 'stat' to detect a new file and then move it to a different directory?

Ultimately I want to detect a new backup file being dropped into a directory and then move that new file to another location for other operations. This needs to work when there is nobody logged into ...
0
votes
2answers
121 views

Run a script every minute without cron and allowing children

I've written 2 php scripts one worker and one master. If I run master manually it checks a rabbitmq system and spawns 1 worker for each queue it detects. Then if I run master again it checks see if ...
0
votes
1answer
27 views

Cron running script to check line for a comment

WE are running plesk on Centos 7 and need to check this config file every 5 minutes to make sure that line x is commented out as plesk keeps un commenting it. We would run this under cron every 5 ...
0
votes
0answers
52 views

notify-send with crontab in i3

So, I've read a lot of forum topics on this, but none of them seem to help and I just cannot get this working. I am trying to create a cron job that sends a notification via notify-send. I am ...
-1
votes
2answers
33 views

About a Mplayer Cron Job

I'm currently tinkering with a process to play an internet radio stream on a certain schedule everyday. After some research, I came up with this code for Crontab : 00 22 * * * mplayer http://listen....
0
votes
1answer
17 views

Can't email errors for cron job

I have the following entry running and I receive an email.. MAILTO=x.y@googlemail.com * * * * * echo "blaah" However, when I have this as a cron job, no email is received... MAILTO=x.y@googlemail....
0
votes
2answers
16 views

How to pass in log file creation to pass in to script to attach the file

I have several cron jobs I run to back up dbs: 0 8 * * * BACKUP=DEV DB=01 /usr/local/bin/backup.sh > /var/log/backup-db01-`date "+\%m\%d\%y"`.log 2>&1||/usr/local/bin/create-ticket.sh 0 16 ...
0
votes
1answer
35 views

Crontab acting weird

So building on my last question here I got it to work, but then I tried making a crontab out of it, to check the number of lines at a given date every 2 minutes. So my script looks like this 1 test=/...
1
vote
1answer
63 views

Does crontab accept commands with several lines as shell expected?

We want to execute the following line each time at 00:00 night Dose this line is valid in crontab or cron job inspite commands with several lines ? 0 0 * * * find . -type f \( -name '*.wsp' -...
0
votes
0answers
27 views

LFTP dont capture progress when running from crontab

I have an .sh script which includes an LFTP command to transfer files from my server to another one. Everything is working fine. #!/bin/bash HOST='xxxxxx' USER='xxxxxx' PASSWORD='xxxxxx' # DISTANT ...
0
votes
1answer
48 views

create cron job in linux without crontab -e [closed]

I want to use the cron in the linux redhat 7 in order to run some jobs but I not want to use the crontab -e , since some users can change my conf so I did the following example cd /etc/cron.d vi ...
3
votes
2answers
48 views

wget saving files as emply plain text files on boot

I have a bash script in crontab that runs @reboot: The script itself contains a wget command to pull and download a file from the internet When I run my script after signing in and opening the ...
1
vote
1answer
49 views

Adding/removing jobs in Debian crontab files?

I have a shell script which, when run as root, performs various tasks to prepare a Debian (9/stretch) server for running a web application. Amongst the tasks that the script does is append cronjob ...
3
votes
1answer
32 views

Run cron jobs in intended python environment?

I have users root and user1 All of my python scripts have been created by user1 I have created a bash file that needs to be automated. The bash file calls my python scripts I have added my bash call ...
4
votes
1answer
250 views

How are files under /etc/cron.d used?

How are files under /etc/cron.d used? From https://www.cyberciti.biz/faq/how-do-i-add-jobs-to-cron-under-linux-or-unix-oses/ cron reads the files in /etc/cron.d/ directory. Usually system daemon ...
2
votes
2answers
73 views

Delay further startup until time is synced

I'm running a Raspberry Pi Model 2B with Raspbian Stretch (Debian). I have a UI-application (chromium-browser, started via /home/pi/.config/lxsession/LXDE-pi/autostart) and a script started via cron, ...
2
votes
2answers
57 views

Can I schedule running a script inside a particular shell process once in a while?

cron can be used to schedule running a program once in a while. But it seems to be not specific to an existing shell process. If I have a script which accesses the state of a specific bash process (e....
1
vote
2answers
66 views

fstab mounting time

I'm working on a script that is supposed to execute on startup, but the problem is that the script requires some files that are on a shared drive that is automatically mounted via fstab and at the ...
3
votes
2answers
875 views

A filename has an asterisk for some reason - it won't be changed and content not executed

I use CentOS shared server environment with Bash. ll "$HOME"/public_html/cron_daily/ brings: ./ ../ -rwxr-xr-x 1 user group 181 Jul 11 11:32 wp_cli.sh* I don't know why the filename has an ...
1
vote
4answers
103 views

Yum with crontab - “Another app is currently holding the yum lock”

I want to use crontab to run a script for yum updates. The problem is it seems it will run the script once, then yum is just stuck for a while (and can't be ran again). I get this error: $ sudo yum ...
0
votes
1answer
118 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 ...