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 [crontab]

Crontab is a short form of cron table. It is a configuration file that specifies shell commands to run periodically on a given schedule.

16
votes
1answer
1k views

Cron runs only once instead every minute

I'm trying to run a script every minute (on a Docker container running Ubuntu 16.04). The /etc/echo.sh simply echo the word "hi" cat /etc/crontab * * * * * root /etc/echo.sh > /var/log/cron.log ...
0
votes
1answer
12 views

How to check cron modified time?

How to find cron job modified time in Ubuntu, For Example: when the cron job has been modified or changed.
0
votes
0answers
9 views

Use of sudo to remotely run crontab -l hangs, ctrl-c the session and crontab file is zeroed out

I recently tried to SSH to a remote machine and list the root crontab with the following command: ssh remotehost sudo crontab -l The command hangs, and when the hung session is killed using Ctrl-C, ...
0
votes
0answers
28 views

Crontab runs but doesn't execute

My crontab looks like this * * * * * /opt/PPP/update_playlists.sh >> /var/log/cron.log 2>&1 */5 * * * * /opt/duckdns/duck.sh >/dev/null 2>&1 (I set to every minute for testing ...
0
votes
1answer
21 views

How to start a service at startup

I am using Ubuntu Server to make a Kodi box. I'm using kodi-standalone-service to do so. I have made a shell script (sudo -S <<< "password" systemctl start kodi) to start kodi. When I run it ...
0
votes
1answer
32 views

How to check whether my script ran successfully in crontab

I am new to Unix and I need some help to know how to check whether my script has picked by crontab and ran as per schedule (not manually).
0
votes
1answer
47 views

Linux Crontab backup not working for a folder in root

I have a directory located at root... cd / li drwxrwx--- 8 root fred 4096 Nov 3 15:28 ourdirectory Created a sudo crontab command... 20 8 * * 1-7 sudo tar -cpzf /mnt/backupdrives/backup.tar.gz /...
-2
votes
1answer
150 views

gzip command is not working in shell script [closed]

If I run my script through crontab, gzip is not working fine. If I run the same script manually gzip is working. The command we have in our script is gzip -vf $path/file.eee In my script I am ...
0
votes
0answers
17 views

Disable/Enable Cron on a schedule

I have a crontab running on a raspberry pi to take regular temperature readings. */1 6-17 * * 1,2,3,4 /home/pi/py/localtemp.sh */1 6-17 * * 1,2,3,4 /home/pi/py/readtemp.sh As you can see they run ...
0
votes
0answers
99 views

How can I keep crontab automation work on macOS 10.14 after an user locked screen?

In macOS 10.13 I can just using crontab with AppleScript to turn my mac to an alarm with iTunes playlist. But it seems not working on 10.14, first there were new setting about automation in System ...
0
votes
3answers
40 views

How can I execute all commands in crontab subsequently?

Consider a complicated crontab of +100 lines where a lot of scripts are run subsequently to poll & process messages from different clients. Upon reboot of the server, I trigger some scripts of ...
1
vote
1answer
316 views

How to handle daylight savings in cron jobs

I have a cron job on an amazon ec2 machine (Ubuntu 16.04) that is supposed to run at 2:00 AM Central time. The cron job is scheduled using UTC time. Since Central time is currently UTC-5 (we are in ...
0
votes
1answer
50 views

How to use brew in crontab

I run an alias in my .zshrc file every day. alias buou="brew update && brew outdated && brew upgrade" I want to run it by crontab on my macOS v10.13.6 I made a file called ...
1
vote
0answers
278 views

cron job not running /bin/bash: user: command not found

I'm trying to run a cron job that executes a script as a user using crontab -e on ubuntu server 16.04 LTS. The script is and located in /data/autoremove.sh: !/usr/bin/env bash if ping -q -c ...
0
votes
0answers
144 views

Bad hour error in my cron

i have an issue with my cron (bad hour error). Code of the task to drop cache is: 0 */4 * * * root sync && echo 3 >/proc/sys/vm/drop_caches && sync What is wrong with it?
2
votes
2answers
189 views

Can't get audio from anything run via cron/crontab in Linux Mint

I am using Linux Mint 18.3 Cinnamon 64-bit (Version 3.6.6), and I can't get any audio from ANYTHING run via cron. That includes command-line audio file players, TTS apps like espeak or festival, etc. ...
3
votes
1answer
247 views

Why is the `cron.hourly` line in `/etc/crontab` the only one without `test -x /usr/sbin/anacron`?

I haven't changed my /etc/crontab, yet. It's still the default content, which is also the default content for many Linux distros: # /etc/crontab: system-wide crontab # Unlike any other crontab you ...
2
votes
1answer
795 views

Cron job to delete files older than x days?

I'm currently using this cron job to delete stalled temp files in a particular location. How can I improve this to only delete files older than x days (e.g., 30 days)? 0 4 * * 0 /bin/rm -fv /home/*/...
0
votes
2answers
358 views

Command After Semicolon Not Executed in Crontab?

Here is my crontab: 42 17 * * 1-5 /bin/pkill -f 'MyExecutable.exe' ; touch /tmp/here.log And according to /var/log/cron it did run: May 22 17:42:01 server1 CROND[326732]: (myuser) CMD (/bin/pkill -...
0
votes
1answer
72 views

Getting the crontab text template from within a bash script

crontab -e initially picks up a text template, apparently from this file https://anonscm.debian.org/cgit/pkg-cron/pkg-cron.git/tree/crontab.c. I'd like to programatically fetch that block of text, so ...
0
votes
1answer
289 views

Where exactly in the boot process does @reboot in a Cron execute?

Where exactly in the boot process does @reboot execute? Would a script starting with @reboot in /etc/crontab run immediately after the kernel is loaded? Is it after all system services are loaded? ...
1
vote
0answers
147 views

Debian 9 upgrade cron Error: bad minute;

Debian stretch 9.4 Recently updated from 9.x can't remember the exact previous version I noticed that cron is complaining about this /etc/cron.d/sync crontab file Mar 15 10:35:00 yop cron[26343]: ...
0
votes
1answer
236 views

Cron expression to run on 6th 7th and 8th business day

I am building a cron expression that has to run every 30 minutes only on a range of business days, eg: 6th,7th and 8th business days of a month. Currently I have a cron expression but that only runs ...
0
votes
1answer
85 views

Define sys path to be considered by python script under crontab

Consider you have the following crontab definition: * * * * * /home/dan/test.py Consider you have the path /home/dan/foo/, where foo directory holds a python module named foo. Whereas test.py ...
0
votes
1answer
107 views

how to use crontab -c @reboot to autostart redmine

I have installed a Redmine on CentOS 7, I can run the Redmine application by manually execute the command of cd /var/www/html/redmine && bundle exec rails server webrick -e production -b 192....
0
votes
1answer
36 views

Interpolated Environment Variable unset in cronjob using /bin/ip command

I have the following script in myuser's home directory #!/bin/bash # startup.sh export HOST_IP=$(/bin/ip -4 addr show enp2s0 | /bin/grep -Po 'inet \K[\d.]+') echo "Using HOST_IP=$HOST_IP" and the ...
0
votes
0answers
40 views

Is it possible to pass a PID variable as a parameter into a crontab?

Is it possible to pass a PID variable as a parameter into a crontab: 0 * * * * JETTYPID=$(ps aux | grep "jetty92.state" | grep -v grep | awk '{print $2}') OR Could I just define the variable at the ...
0
votes
2answers
133 views

Crontab doesn't execute any simple command

Logged as user pi I execute: crontab -e and I add this line to the end of the file, save and exit. @reboot touch /home/pi/Documents deleteme Then I reboot and I cannot find any file deleteme inside ...
1
vote
1answer
2k views

Crontab not running python script, no errors no nothing

Already spent over 1h to make that easy thing and totally failed :/ Cant find why that python not working on crontab while it works perfect in commandline... Script is (bash): #!/bin/bash touch ...
1
vote
1answer
333 views

bash command inside crontab is not working

I have a crontab which runs every minute and removes some directory and files. My cron looks like this * * * * * bash /var/www/html/Database/Backup/Remove_Old_Backups >/dev/null 2>&1 In ...
1
vote
1answer
43 views

Linux - Can cron run a script only when a specified application is running?

I want to run a script every 5 seconds, but (to conserve resources) only when a specified application is running. Is there a way to do that with crontab?
0
votes
1answer
754 views

Crontab: run a job once on Sunday and twice on the other week days

There is a way to run cron jobs on different days of the week, for example 0 8,16 * * 1-6 runs a job at 8:00 and 16:00 Monday to Saturday. What if the job should run on Sunday as well, but only ...
0
votes
1answer
2k views

Error in Crontab

10 45 * * 1-3 changeExtension.sh When i am saving this particular file i am getting the following error:- crontab: installing new crontab "/tmp/crontab.eel6sL":1: bad hour errors in crontab ...
0
votes
1answer
97 views

Hourly Cron job will not run but will manually run fine

Background - the system has two different versions of ruby installed. I need to use the latest version to run this monitor script i've created This is my crontab line: 0 * * * * /usr/local/rvm/...
0
votes
2answers
1k views

logrotate does not rotate at the time specified in crontab

I am wondering why logrotate does not rotate my logfiles at the time which it is called through crontab. My entry in crontab is: 50 2 * * * /usr/sbin/logrotate Therefore all my logs should be ...
0
votes
1answer
545 views

Can send an email using a bash script called by crontab but not by a Jenkins job

I installed and configured a mail client: sudo apt-get install heirloom-mailx sudo vi /etc/ssmtp/ssmtp.conf mailhub=smtp.mail.yahoo.com:587 FromLineOverride=YES AuthUser=myuser@yahoo.com AuthPass=...
0
votes
1answer
117 views

Crontab does not launch when log out

On a google Cloud Ubuntu VM, I have setup few crontab like below : 0 15 * * * sudo /home/username/bin/python /home/username/project27/scheduler/batch.py &>> /home/username/project27/...
4
votes
1answer
684 views

Get cronjob Email alert only on errors, not for other stdout?

I have a cron job that runs a script.sh file (Which takes the backup of DB), and sends me an email every hour. In script.sh file, I'm taking backup of few databases(.sql file), then creating .zip of ...
0
votes
1answer
213 views

List or update contents of a directory when modified (ie new file created or file deleted) to a text file

I use linux mint and I want a text file to reflect the changes of files in a directory, it should contain the names of files that exist in the directory and add newly created files automatically. I ...
1
vote
3answers
105 views

Can I interrogate the Linux operating system through a SQL interface? [closed]

E.g. for crontab. I don't want to parse it. I want to run a sql query vs (as a minimum) a jdbc-compliant connection (automagically provided provided by Linux, that returns exactly that). But I mean - ...
0
votes
0answers
327 views

Crontab not executing my python script, any input? [Solved]

I wrote a python script that uses the rsync command to back up a specific folder. BackupApacheServerAnalysis.py Script: #!/usr/bin/env python import os os.system("rsync -av --delete /root/Desktop/...
0
votes
1answer
266 views

No crontab command is working

user hacker belongs to sudoers A command like python2 slowloris /home/hacker/scripts/slowloris/slowloris.py 192.168.1.5 -s 1000 only works manually. The clock is synchronized! syslog: I dont know ...
1
vote
0answers
18 views

Collecting information about server usage and storaging in XML format using sysstat

I need to save the metrics below in XML format: Input / Output and transfer rate statistics (global, per device, per partition, per network filesystem and per Linux task / PID). CPU statistics (...
0
votes
1answer
200 views

Unable to save and exit an editor

I open new window by typing crontab -e in terminal. After that I placed this line at the bottom. 0 5 * * * /home/myname/scripts/do-every-day.sh But I cannot save and exit by pressing Esc, :wq and ...
0
votes
1answer
942 views

environment variables fail to set in cron task

I am attempting to install a new cron task on a server. I am able to run the process via command line, but cannot run it via cron. This is due to enviroment variables for PATH and PYTHONPATH not ...
0
votes
1answer
481 views

curl is executed twice from crontab

I have installed centos 7 and PHP 5.6.29 on my server, and I set up crontab to run this command every 15 minutes: */15 * * * * curl http://example.com/check.php but the command is run twice. Is ...
0
votes
0answers
113 views

cronjob scripts keep running after finishing their job

I have a cronjob that runs every 10 minutes. The script that is running detects sometimes a problem and starts a service (using /sbin/service XXX start) that ultimately starts a java process. In case ...
0
votes
1answer
38 views

Mac OS X - How to delete automatic scripts or application actions?

I've a script installed that regularly executes on the full hour. A friend of mine installed it way back and I finally want to get rid of it. The problem: neither do I know the path to which it was ...
0
votes
2answers
171 views

Cron not executing command

I am running Debian sid. I'm trying to get audacious to start up and play an online radio station at 9 AM on Mon, Tue, Wed, & Thu every week. I have the station URL saved in a pls file which I ...
0
votes
0answers
258 views

set up identity file but still can't ssh without environment variables

I am trying to set up a scp job on crontab and am testing that ability through the console. The crontab doesn't import environment variables, so I'm testing this through env -i, but also importing the ...