Web Cronjobs is a web based tool that helps you manage all cron jobs in one place.
Thank you for purchasing Web Cronjobs. If you have any questions that are beyond the scope of this help file, please feel free to contact me. Thanks so much!
You can find below a full list of requirements. Also you can upload requirements.php file to your server and run it via browser to see whether you can run Web Cronjobs on your server.
First of all you need to configure MySQL database credentials. To do this open ~root/protected/config/db.php and set up database settings.
<?php return [ 'class' => 'yii\db\Connection', 'dsn' => 'mysql:host=localhost;dbname=webcron', 'username' => 'my-user-name', 'password' => 'my-password', 'charset' => 'utf8', 'tablePrefix'=>'webcron_', 'enableSchemaCache'=>true, 'schemaCacheDuration'=>60*60*24*30, ];
If you need to specify database port, use following construction:
'dsn' => 'mysql:host=localhost;dbname=webcron;port=3306',
You need to replace highlighted words with your own data:
localhost | The host of the MySQL database. Usually it's localhost |
webcron | The database name |
my-user-name | The database username |
my-password | The password of database user |
Next you need to configure email client. Emails are sent using SwiftMailer extension. Email configuration file is ~root/protected/config/mailer.php
Example of SMTP via SSL encryption.
<?php return [ 'class' => 'yii\swiftmailer\Mailer', 'viewPath' => '@app/mail', 'transport' => [ 'class' => 'Swift_SmtpTransport', 'host' => 'mail.example.com', // Replace with your mail server host 'username' => 'my-username@example.com', // Replace with your own user name 'password' => 'my-password', // Replace with your own user password 'port' => '465', 'encryption' => 'ssl', ], ];
Example of SMTP via TLS encryption.
<?php return [ 'class' => 'yii\swiftmailer\Mailer', 'viewPath' => '@app/mail', 'transport' => [ 'class' => 'Swift_SmtpTransport', 'host' => 'mail.example.com', // Replace with your mail server host 'username' => 'my-username@example.com', // Replace with your own user name 'password' => 'my-password', // Replace with your own user password 'port' => '587', 'encryption' => 'tls', ], ];
Example of SMTP without encryption.
<?php return [ 'class' => 'yii\swiftmailer\Mailer', 'viewPath' => '@app/mail', 'transport' => [ 'class' => 'Swift_SmtpTransport', 'host' => 'mail.example.com', // Replace with your mail server host 'username' => 'my-username@example.com', // Replace with your own user name 'password' => 'my-password', // Replace with your own user password 'port' => '25', ], ];
Example of Sendmail
<?php return [ 'class' => 'yii\swiftmailer\Mailer', 'viewPath' => '@app/mail', 'transport' => [ 'class' => 'Swift_SendmailTransport', ], ];
Since this is not native linux (or windows) cron job system we need to set up custom handler to handle all our cronjobs created via web interface.
The following command should be used:
* * * * * /usr/bin/php /path/to/web/root/protected/yii exec >/dev/null 2>&1
Note! There is special script that could help you build properly command. Run in a browser: http://place-where-you-installed-script.com/command.php
* * * * * |
Time and date for your task. * * * * * - every minute |
/usr/bin/php | path to php command |
/path/to/web/root/protected/yii exec | physical path to script and additional parameter exec |
>/dev/null 2>&1 | this mean that all output from this command should be shoved into a black hole. I.e just do nothing with output. |
Below you can find tutorials how to setup cron job in cPanel, Plesk and on *nix platform.
It may happen that your hosting provider doesn't support periodical cron tasks or the minimum interval is more than one minute. In this way you could try to create account in 3rd party service and call specified URL to trigger handler of all your cron tasks. To make HTTP cron jobs handler work you need to specify secret key in config file. Open ~root/protected/config/params.php and set webHandlerKey. For example:
'webHandlerKey'=>'my-very-very-secret-key',Now you can call http://example.com/index.php/en-US/cron-job/exec?key=my-very-very-secret-key to trigger cron jobs handler
Next we must configure some important application parameters. All parameters are stored in ~root/protected/config/params.php file. Here is the following list of parameters that you have to change:
cookieValidationKey | This is a secret key used for cookie encryption |
cookiePath |
Cookie path If you installed script in subdir. for example: http://my-domain.com/webcron, then the cookiePath must be: /webcron If you installed script in web root. for example: http://my-domain.com, then the cookiePath must be: / |
notificationFrom | The "from" email which is used in email notification |
baseUrl |
Base URL of the App. Used for console program If you installed script in subdirectory, then the URL must be in a following format: http://my-domain.com/sub-dir If you installed script in web root, then the URL must be in a following format: http://my-domain.com |
PHP cURL extension is used to trigger URLs. There is special config file where you can define default request options, for example: user agent, timeout and etc. The file path is:
~root/protected/config/curl.php.
Here you can find all options that support cURL.
The configuration process has been finished. Next you need to log in. Admin has following default credentials:
Login: admin
Password: admin
Don't forget to change password and user email.
UPDATE `webcron_user` SET password = '$2y$13$7MNJvemLPJaBa8BDSGFd6urz5.6A7tn3NyZ1VVeZfgi0lIRj.CqXW' WHERE id = 1;
Web Cronjobs supports all cron expressions that you can find in general Linux Cron implementations + additional syntax of "last {dayOfWeek} of the (X) month" and "static date".
Here you can find a list of examples. Username and password is codecanyon
To change password click on Account settings and choose Change Password from expanded list.
To change password click on Account settings and choose Profile Settings from expanded list.
To change password click on Account settings and choose Account Settings from expanded list.
All translations are stored in ~root/protected/messages/ directory.
Below you will find instruction how to create new translation.
1 Step.
Let's create German translation. Open ~root/protected/messages/ directory and create new directory, in our case it's de-DE: ~root/protected/messages/de-DE
2 Step.
Copy all files from ~root/protected/messages/en-US/ to ~root/protected/messages/de-DE/ open them and translate.
3 Step.
Add new key=>value pair into ~root/protected/config/params.php
'languages'=>[ 'en-US'=>'English', 'ru-RU'=>'Русский', 'de-DE'=>'Deutsch', ],