How to schedule bulk cron jobs in Linux? Easy peasy

  1. Login as root user through SSH (I prefer putty)
  2. To view crontab entries execute following command:
  3. To edit crontab directly you can use:
  4. But for bulk editing it’s not really convinient, right? Instead, we’ll create editable file with all needed entries first and then load it to crontab.
    1. Prepare crontab entries in regular .txt. For WordPress Multisite Cron it will look something like this:

      or you can use curl instead:

      I wont explain here crontab syntax in details as there are loads of instructions you can easily find.
    2. Create file in desired directory (that’s my root in Centos):
      cat > /var/www/www-root/data/my_cron.txt
      This will create file and open it for editing at once.
      How to schedule bulk cron jobs in Linux? Easy peasy
      You can edit it right here ( ctrl-c to past prepeared lines, ctrl-d to save ) or even through FTP if it’s more convinient to you.
      Mind, that next step will replace all existing entries in your current crontab. So in order to preserve them, remember to add them to your my_cron.txt as well.
    3. Update crontab with new values:
    4. List cron jobs to verify your crontab has been updated correctly:

    Not that complicated, right?

     

    From now when it comes to cronjobs you won’t waste your time anymore adding them manually.
    Just have extra cup of coffee instead)

Leave a Reply

Your email address will not be published. Required fields are marked *