How to manage your crons

Applies to:
Professional Hosting
Business Hosting
WordPress Hosting

Difficulty:
Easy

Time Needed:
10 minutes

Introduction

This is a quick step-by-step guide to viewing, adding and removing crons via the 34SP.com Control Panel.


Article Contents


Please Note: We recommend you only make alterations to the cron page if you have prior experience setting up crons.



How to view your crons


Step 1

Login to your account

Firstly, you'll need to login into your 34SP.com account at http://account.34sp.com.

Login to your account

Step 2

Choose 'Manage Sites'

Once you have logged in, click on the 'Manage Sites' icon.

This will bring up a list of websites or domain names you have in your 34SP.com account. Simply choose the website you wish to edit by clicking on it.

Choose 'Manage Sites'

Step 3

Select 'Advanced'

After you have clicked on the website you wish to edit, you will be presented with your website overview page. Choose 'Advanced' from the product navigation.

Select 'Advanced'

Step 4

Choose 'Manage Crons'

Then click on the icon labelled 'Manage Crons'.

Choose 'Manage Crons'

Step 5

Managing your crons

The 'Manage Crons' page provides an overview of your scheduled tasks, with each cron listed in a table. Along with viewing each cron you can also remove them via the table, by clicking on the relevant icon.

Managing your crons

How to add a new cron


Step 1

Add new cron

If you wish to add a new cron, simply click on the button labelled 'Add New Cron' when viewing the 'Manage Crons' page.

Add new cron

Step 2

Enter cron time

This will bring up a form. Simply fill in the form with the time intervals that you wish your cron to run.

You can use * in any time field to ignore that field. You can also use a / to indicate a repeating pattern, .e.g., */2 in the 'Minute' field would indicate 'every two minutes'.

Enter cron time

Step 3

Enter cron command

Then copy & paste your command into the text box labelled 'Command'. Be sure to use the full path to any programs and refer to the examples at the end of this page if you get stuck.

When you're done, click 'Create New Cron' to save your changes.

You'll then be returned to the 'Manage Crons' page, were your new cron will be listed in the table.

Enter cron command

How to delete a cron


Step 1

Remove a cron

If you wish to delete a existing cron simply click on the 'Remove' button (the 'trash' icon) for the cron you wish to remove, when viewing the 'Manage Crons' page. This will remove the cron permanently.

Remove a cron

How to setup email notification


Step 1

Choose 'E-mail Notification'

When viewing the 'Manage Crons' page, just click on the tab labelled 'E-mail Notification'.

Choose 'E-mail Notification'

Step 2

Enter an email address

This will bring up a form. Simply fill in the form with an email address of your choice. When you're done, click 'Save Settings' to save your changes.

The output of all your cron tasks will now be emailed to the email address you specified.

Enter an email address

Example Crons


Run a PHP script every hour

To run a PHP script once every you should set the 'Minute' field to 0, this means it will run on the hour. You could set the field to 30 to run the cron at 30 minutes past every hour. The other time/date fields should be set to *, to indicate that those fields are ignored.

The command field should contain the path to PHP then the path to the script file to be run.

/usr/bin/php /var/www/vhosts/mydomain.com/httpdocs/myscript.php

Run a PHP script every hour

Access a web page every 10 minutes

To access a web page every 10 minutes you should set the 'Minute' field to */10. The other time/date fields should be set to *, to indicate that those fields are ignored.

The command field should contain the path to Curl then the URL of the web page to be accessed.

/usr/bin/curl https://www.mydomain.com/myscript.php

Access a web page every 10 minutes

Backup a database every Sunday at 2am

To backup a database every Sunday at 2am you should set the 'Day of week' field to 0, as days are referenced numerically, beginning with Sunday. To run the cron on Wednesday you would use 3. The 'minute' field should be set to 0, to indicate 0 minutes past the hour, and the hour should be set to 2, for 2am. The other time/date fields should be set to *, to indicate that those fields are ignored.

The command field should contain the path to mysqldump, followed by the database access details and finally a redirection to the backup file.

/usr/bin/mysqldump -u mydatabaseuser -pmydatabasepassword mydatabasename > mybackupfile.sql

Backup a database every Sunday at 2am

Was this helpful?

   
165 people found this article helpful