Crontab (Linux/CentOS 7) – More frequent than 1 minute

Robert Andresen Uncategorized Leave a Comment

Setting up crontab

Open and edit crontab file

# crontab -e


Add this line (Change the path to your own)

*/1 * * * * sh /usr/bin/ >> /var/www/mywebpage/cron_log.log

This will open the every minute.


Create a new shell-script file

#vi /usr/bin/

The .sh script will open the cron.php every 15 secounds.

/usr/bin/php -f /var/www/mywebpage/cron.php
sleep 15s
/usr/bin/php -f /var/www/mywebpage/cron.php
sleep 15s
/usr/bin/php -f /var/www/mywebpage/cron.php
sleep 15s



PHP cronjob manager

THIS IS NOT NEEDED TO USE CRONTAB – It’s just my own little crontab manager in PHP!
I like to add, edit and test cronjobs in my browser – and log when they was last runned. This is because I have some sync files, that could be called manually, like user-sync with AD LDAP. If new users are missing, I can at least check when the last sync was called. I can also run it manually from GUI.

SQL script

This script was written in just a few minutes and should NOT be used in a production enviroment without the knowledge to qualify it your self!