TIP – Creating a Cron Job for MySQL Database Cleaning



  • Here is how you create a cron job on your server for performing a 'cleanAllOlder' task:

    1- Login to your server using SSH

    2-

    cd /etc
    nano crontab

    3- add following code to your crontab file, replacing 'YourURL' (and 'jabbercam', if different) with the one below

    0 * * * * /usr/bin/wget -q -O /dev/null http://YourURL/jabbercam/admin.php?task=cleanAllOlder

    4- exit nano by saving the file:

    CTRL+X
    y
    ENTER

    5- execute:

    crontab crontab

    That's it!

    Above example sets cron job to run evey hour. Other examples are:

    15 5 * * * every day at 05:15
    0 * * * * hourly

            • every minute
              */15 * * * * every 15 minutes
              0 2,10,19 * * * run 3 times a day: at 02.00, 10.00 and 19.00 hours

Log in to reply