iam about to blow up: i cant figure out why my jobs in the crontab -e file of any user are not running. None of them do so the "last cron job is not running" problem is not aplicable. Also i checked  thread and couldn't find any mistakes. I even escaped my percent signs.  Here's my crontab -e file when running under the root user:  # Edit this file to introduce tasks to be run by cron. # # Each task to run has to be defined through a single line # indicating with different fields when the task will be run # and what command to run for the task # # To define the time you can provide concrete values for # minute (m), hour (h), day of month (dom), month (mon), # and day of week (dow) or use '*' in these fields (for 'any').# # Notice that tasks will be started based on the cron's system # daemon's notion of time and timezones. # # Output of the crontab jobs (including errors) is sent through # email to the user the crontab file belongs to (unless redirected). # # For example, you can run a backup of all your user accounts # at 5 a.m every week with: # 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/ # # For more information see the manual pages of crontab(5) and cron(8) # # Minute Stunde TagIMonat Monat TagIWoche Kommando # m h  dom mon dow   command 50 3 * */2 * /usr/bin/openssl pkcs12 -export -out /home/user/export.pfx -inkey /etc/letsencrypt/live/domain/privkey.pem -in /etc/letsencrypt/live/domain/chain.pem -password pass: blabla &gt; /var/log/cron.log 51 3 * */2 * /usr/bin/sshpass -p xxx scp /home/user/export.pfx root@255.255.255.255:/path/to/file/&gt; /var/log/cron.log 0 0 */5 * * /usr/bin/rsync -avx /var/www/nextcloud/apps /nextcloud/backup/path/nextcloud-apps_`date +"\%Y\%m\%d"`/ &gt; /var/log/cron.log 0 0 */5 * * /usr/bin/rsync -avx /var/www/nextcloud/config/config.php /nextcloud/backup/path/nextcloud-config_`date +"\%Y\%m\%d"`/ &gt; /var/log/cron.log 0 0 * * * /usr/bin/mysqldump --single-transaction -h localhost -u user -pPassword db &gt; /nextcloud/backup/path/nextcloud-sqlbkp_`date + "\%Y\%m\%d"`.sql &gt; /var/log/cron.log   Maybe someone can help me with my problem.  Thanks
589
This is a  about using cron &amp; crontab.   You have been directed here because the community is fairly sure that the answer to your question can be found below. If your question is not answered below then the answers will help you gather information that will help the community help you. This information should be edited into your original question.  The answer for 'Why is my crontab not working, and how can I troubleshoot it?' can be seen below.  This addresses the cron system with the crontab highlighted.
62806
I am currently trying to understand the difference between init.d and cron @reboot for running a script at startup/booting of the system.   The use of @reboot (this method was mentioned in  by hs.chandra) is some what simpler, by simply going into crontab -e and creating a @reboot /some_directory/to_your/script/your_script.txt and then your_script.txt shall be executed every time the system is rebooted. An in depth explanation of @reboot is   Alternatively by embedding /etc/init.d/your_script.txt into the second line of your script ie:  #!/bin/bash # /etc/init.d/your_script.txt  You can run chmod +x /etc/init.d/your_script.txt and that should also result for your_script.txt to run every time the system is booted.  Q1: What are the key differences between the two? Q2: Which is more robust? Q3: Is there a better one out of the two? Q4: Is this the correct way of embedding a script to run during booting?  I will be incorporating a bash .sh file to run during startup.
43827
The following crontab does not work:  # TEST LINE DOES DOT RUN */1 * * * * /bin/echo 'test '`/bin/date +%Y-%m-%d` &gt;&gt; /tmp/test   I also tried starting it with:  SHELL=/bin/bash   Update: I thought the backtick characters ` were the villains, but as the answer below clarifies the percentage % was the culprit!
92130
I have created a script to install two scripts on to the crontab.   #!/bin/bash   sudo crontab -l &gt; mycron  #echo new cron into cron file   echo "*/05 * * * * bash /mnt/md0/capture/delete_old_pcap.sh" &gt;&gt; mycron #schedule the delete script  echo "*/12 * * * * bash  /mnt/md0/capture/merge_pcap.sh" &gt;&gt; mycron     #schedule the merge script  #install new cron file  crontab mycron rm mycron   The script runs, and add the two lines to the crontab. But if I run the script again, it adds those lines again , thus I will have four lines saying the same stuff. I want the install script to run such that, the lines inserted to the crontab do not repeat. How can I do that
96679
I'm running on a couple of different Linux distros (Fedora 11, CentOS 5 and SuSE 10.2) and  often run into a problem where a new script that I want to run as a cron job works fine when called direct from the command line, but fails when called from cron due to slight variations in the PATH or other required environment variables.  Is there a way I can test run an individual script as if it's being run from cron, without having to run the entire crontab or use run-parts to run the entire cron.daily/ .hourly etc. directory ?  I guess I could temporarily edit my crontab to run the script in the next couple of minutes, but I'd rather have a more standalone solution so that I don't risk messing up the crontab.
1708
I am new to linux and I read and followed many instructions to run a python script at reboot but non of them worked:  this is the command I want to run:  /usr/bin/python3 /home/am/projects/AMAcc/map.py   I used crontab -e and added   @reboot /usr/bin/python3 /home/am/projects/AMAcc/map.py   I tried sudo crontab -e and added the same command  I even edited /etc/crontab file and added above command.   Tried adding #!/usr/bin/python3 at top of my python code and changing its permissions like: sudo chmod a+x map.py  As documents suggested that all users would be able to run cron jobs if cron.deny file exists but its empty, so I tried creating empty cron.deny files in both /etc/cron.deny and /usr/lib/cron/cron.deny. But still no luck running the cron job.  What am I doing worng?
25995
I have setup a cron to execute one of my php scripts. But the problem is the php script is not being executed at all not even partially.  Here is the cron I have set up  45 23 * * * /usr/bin/php -q /var/www/myscript.php   I have tried the following   I removed the cron from normal user to root user still no results. I changed the permissions on the script using chmod +x /var/www/myscript.php I have used the command whereis php it gives the following  php: /usr/bin/php /usr/share/man/man1/php.1.gz    Now, I don't know what else I can do. Please Help.  P.S. I can execute the script manully and it runs perfectly.
76130
I have set up a cron job, but for some reason it fails to run during the night. The same job runs fine when i'm running it during the day (i.e. setting up the same job to run in a few minutes and waiting for it to run).  Some logs:  Jun 17 14:04:01 server CRON[20174]: (root) CMD (/home/server/scripts/sync.sh &gt;&gt; /home/server/logs/nightly.log 2&gt;&amp;1) Jun 17 14:12:01 server CRON[20349]: (root) CMD (/home/server/scripts/sync.sh &gt;&gt; /home/server/logs/nightly.log 2&gt;&amp;1) Jun 17 14:23:01 server CRON[20513]: (root) CMD (/home/server/scripts/sync.sh &gt;&gt; /home/server/logs/nightly.log 2&gt;&amp;1) Jun 18 01:00:01 server CRON[25717]: (root) CMD (/home/server/scripts/sync.sh &gt;&gt; /home/server/logs/nightly.log 2&gt;&amp;1) # this runs during the night Jun 18 01:00:01 server CRON[25706]: (CRON) error (grandchild #25717 failed with exit status 2) # doesn't leave anything behind it, not even the nightly.log file - as though the command itself is invalid)   cron entry looks like this:  0 1 * * * /home/server/scripts/sync.sh &gt;&gt; /home/server/logs/nightly.log 2&gt;&amp;1   script looks like this:  #!/bin/bash  SUCCESS=0 echo "Running nightly automation..." echo "Running xxxx script..." SUCCESS=`/home/server/scripts/xxxx.sh &amp;&amp; echo 1` if [ $SUCCESS -eq 1 ]; then         echo "xxxx success!" else         echo "xxxx fail!" fi echo "Running rsync..." /usr/bin/rsync -am --remove-source-files /path1/ /path2/ --log-file=/home/server/logs/sync.log &amp;&amp; echo "rsync success!"
33468
I did edit /etc/crontab using corntab -e. I have only one entry  After save contab is not created despite the message.  To be honest I have no idea what to do. I simply want to create a simple daily job. Second question. How can I change the editor for crontab -e?
77289
Since upgrading my user's crontab has been wiped out. This is not the first time this has happened this year and it's a pain restoring it each time.  I'd like to be able to back up the crontab for my user but for that I need to know where it's stored.
92777
I have a backup script which I need to run at a particular time of a day so I am using cron for this task and from within cron am also trying to redirect the output of backup script to a logfile.  crontab -e  */1 * * * * /home/ranveer/backup.sh &amp;&gt;&gt; /home/ranveer/backup.log   In the above cron entry I am redirecting both stderr and stdout to a log file.  The above cron job executes fine according to syslog  and it performs the task mentioned in the backup.sh file but it doesn't write anything to the log file.  /var/log/syslog  Oct 19 20:26:01 ranveer CRON[15214]: (ranveer) CMD (/home/ranveer/backup.sh &amp;&gt;&gt; /home/ranveer/backup.log)   When I run the script from cli it works as required and output is written to a log file  ranveer@ranveer:~$ ./backup.sh &amp;&gt;&gt; backup.log  ranveer@ranveer:~$ cat backup.log Fri Oct 19 20:28:01 IST 2012 successfully copied testdir test.txt successfully copied ------------------------------------------------------------------------------------- ranveer@ranveer:~$    So, why the output of file is not getting redirected to the file from within cron.
21713
I have Anacron set up to run a backup daily, weekly and monthly. The monthly seems okay, but the daily and the weekly are running roughly every half hour every day! Here is my /etc/anacrontab # /etc/anacrontab: configuration file for anacron                                                                                                                                                                            # See anacron(8) and anacrontab(5) for details.                                                                                                                                                                              SHELL=/bin/sh                                                                                                  PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin                                              HOME=/root                                                                                                     LOGNAME=root                                                                                                                                                                                                             # These replace cron's entries                                                                                 1       5       cron.daily      run-parts --report /etc/cron.daily                                             7       10      cron.weekly     run-parts --report /etc/cron.weekly                                            @monthly        15      cron.monthly    run-parts --report /etc/cron.monthly                                                                                                                                           # PERIOD        DELAY   IDENTIFIER      COMMAND                                                                @daily  3       Rsnapshot_daily /root/scripts/rsnapshot_launcher.sh daily                                      @weekly 15      Rsnapshot_weekly        /root/scripts/rsnapshot_launcher.sh weekly                             @monthly        30      Rsnapshot_monthly       /root/scripts/rsnapshot_launcher.sh monthly  I've checked /var/spool/anacron/Rsnapshot_daily and it has todays date in it and was last updated less than 30 minutes ago. It's now 6pm and the daily Rsnapshot task has been run 11 times today and the weekly 10 times so far. What could be going on here? Thanks. (this is on Kubuntu 20.04 LTS)
14452
Somehow, I am finding it difficult to understand tweaking around * parameters with cron.  I wanted a job to run every hour and I used the below setting:  * */1 * * *   But it does not seem to do the job. Could someone please explain the meaning of above and what is needed for the job?
37848
I am trying to automate the refreshing of awstats for my webserver and understand that I need to use cron to set that up.  So each user has a crontab file? I was following the instructions  community/AWStats And it says to go to the file at: /etc/crontab That file already has some information in it.  Is this the main crontab file or something?  I have seen some instructions online to use the file that pops up with crontab -e. What is the proper file to use and the best way to do this? If I schedule a task as my non-root user, will it run by itself at the time interval as specified, with no issues? Will I need to restart the server after saving the cron job in the crontab file before it will start working?
40322
I have a crontab that looks like  0 0 * * * pg_dump DB_NAME &gt; /path/to/dumps/`date +%Y%m%d`.dmp   which works fine when I run it manually, but not when cron runs it. After digging through the logs, I see  Dec 12 00:00:01 localhost crond[17638]: (postgres) CMD (pg_dump DB_NAME &gt; /path/to/dumps/`date +)   It looks like a problem with percent signs, but the man page doesn't even contain the percent character at all, so I thought they were alright.
38824
I am running CentOS 5.3 and would like to log all messages from the "at" daemon. My syslog.conf contains the following entry:  cron.* /var/log/cron   I assumed that cron line in syslog refers to the entire family of "cron, anacron, at and batch". However, while cron and anacron actions seem to get looged, "at" actions do not get logged. How do I log atd actions?  Thank you for your attention   (Added) I would like to add the contents of my syslog.conf just in case there is an error:  # Log all kernel messages to the console. # Logging much else clutters up the screen. #kern.*                         /dev/console  # Log anything (except mail) of level info or higher. # Don't log private authentication messages! *.info;mail.none;authpriv.none;cron.none        /var/log/messages  # The authpriv file has restricted access. authpriv.*                      /var/log/secure  # Log all the mail messages in one place. mail.*                          -/var/log/maillog   # Log cron stuff cron.*                          /var/log/cron  # Everybody gets emergency messages *.emerg                         *  # Save news errors of level crit and higher in a special file. uucp,news.crit                      /var/log/spooler  # Save boot messages also to boot.log local7.*                        /var/log/boot.log
17549
I have scheduled a cron job to run every minute but sometimes the script takes more than a minute to finish and I don't want the jobs to start "stacking up" over each other. I guess this is a concurrency problem - i.e. the script execution needs to be mutually exclusive.  To solve the problem I made the script look for the existence of a particular file ("lockfile.txt") and exit if it exists or touch it if it doesn't. But this is a pretty lousy semaphore! Is there a best practice that I should know about? Should I have written a daemon instead?