I'm using Webmin on my AWS EC2 Instance
I have created few cron tasks to run every minute.
setup for one cron job is like
in script mode
/var/spool/cron/crontabs/root
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.abHzd4/crontab installed on Wed Feb 7 06:53:10 2018)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
1 * * * * cd /home/ubuntu/public_html && bin/cake generate_script auto_post
1 * * * * cd /home/ubuntu/public_html && bin/cake generate_script timeline
1 * * * * cd /home/ubuntu/public_html && bin/cake queue runworker
5 * * * * cd /home/ubuntu/public_html && bin/cake social_upload upload
2 * * * * cd /home/ubuntu/public_html && bin/cake delete_youtube_videos delete
But it does not run every minute.
Also, how to enable cron logging in Webmin?
It would take some time for your cron jobs to be updated.
Try running from console or theme command shell (Alt+K) the following command to restart crond and re-read the files:
systemctl status crond.service
I know its old question, but on the picture it seems you set it to run every first minute in every hour (not every minute)
Related
I edited the cron file on my Mac running catalina.
I used this code:
crontab -e
And then I added this line
* * * * * python3 ~/Documents/Scripts/script.py
My expectation is that it should run every minute but it hasn't run once.
Do i need to do something special to activate cron on this machine?
Updated my code based on the conversation in the comments to this
* * * * * /usr/local/bin/python3 ~/Documents/Scripts/script.py >>~/Documents/Scripts/script.log 2>&1
I have the following bash script:
clean-tmp.sh
#!/bin/bash
tmpreaper 1h /tmp --test > ./tmpreaper.log
When I run it in the terminal using ./clean-tmp.sh, it writes to the file ./tmpreaper.log.
I added the script to the list of cron jobs using crontab -e:
*/5 * * * * cd /home/cron-jobs && ./clean-tmp.sh
I then checked cron's logs and this entry is in there every 5 minutes:
Feb 19 00:45:01 ip-172-31-23-184 CRON[1475]: (ubuntu) CMD (cd /home/cron-jobs && ./clean-tmp.sh)
But it's no longer writing to ./tmpreaper.log.
What on earth am I doing wrong?
Just specify an absolute path for your file, like tmpreaper 1h /tmp --test > /var/log/tmpreaper.log
#Kacy: Little difficult to say without cron logs, you could have a look to cron logs(/var/log/cron etc).
0,5,10,15,20,25,30,35,40,45,50,55 * * * * cd /home/cron-jobs; ./clean-tmp.sh
May be some systems wouldn't allow time period as the way you tried, try once in above way and let us know then.
I need to set up a cron job that runs every 15 minutes between 8am and 8pm.
After googling, I decided to use it this way:
*/15 8-20 * * * /path/of/shellscript.sh
However, the cron is not getting triggered.
What should be the right expression?
Edits:
*/15 8-19 * * * /path/of/shellscript.sh
00 20 * * * /path/of/shellscript.sh
The cron executes. However the logs show this error:
Mailed 62 bytes of output but got status 0*0047
However, if I run the run the script manually, it executes fine!
Resolved by setting permissions to the sh file and the jar file
chmod 0777 shellscript.sh
chmod 0664 jarfile.jar
I'm trying to schedule a cron job here is my command:
*/5 * * * * USER -q /path/cron.php -mdefault 1
I'm trying to run this magento script every 5 minutes. I see the command being run when I open the cron log via grep CRON /var/log/syslog.
unfortunately the script never executes. I would appreciate any help.
Edit the crontab of the user you want to assign the job to:
sudo -u USER crontab -e
then in the crontab you can schedule the cron.php job in the following way:
*/5 * * * * php /path/to/cron.php
I have following line in crontab
*/1 * * * * xeyes
it does not show any xwindow but on the contrary
*/1 * * * * touch somefile.txt works fine
Tried to search on google but didnt get any specific answers!!
You have to tell cron where to find the X server if the command you run uses it.
So use: env DISPLAY=:0.0 xeyes or export DISPLAY=:0.0; xeyes.
Some cron implementations (Debian, Ubuntu, ...) allows to set enviroment simply in cron file.
DISPLAY=:0.0
# m h dom mon dow command
*/1 * * * * xeyes