Code

Web Cronjobs

Web Cronjobs

Web Cronjobs is a web based tools that helps you manage all cronjobs in one place. The app has powerful set of features.

Note! This is not a native cron job SYSTEM, you must setup one cron job script on your server to handle all other tasks.

Features

  • Unlimited number of cron jobs
  • HTTP cron command
  • Shell cron command
  • Manaul cron job test
  • Logs and prediction
  • Email notifications
  • Cookie Support
  • Cron job statistic
  • HTTP POST support
  • HTTP Headers support
  • HTTP Basic Authorization support
  • Timezone Adaptable
  • Localization ready

Applications demo

Root credentials

Login: codecanyon

Password: codecanyon

DEMO: Web Cronjobs

Installation & Documentation

All information you can find here

Requirements

Important! 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.

  • PHP 5.4.0 or higher
  • Reflection Extension
  • PCRE extension
  • SPL extension
  • Ctype extension
  • MBString extension
  • DOM extension
  • PDO extension
  • PDO MySQL driver
  • MCrypt extension
  • GD extension with FreeType support or ImageMagick extension with PNG support
  • Sockets
  • cURL extension
  • Safe mode (php.ini directive) must be disabled
  • Short open tag (php.ini directive) must be enabled
  • PHP mail SMTP (or sendmail)

FAQ

Q: Why I should use this script instead of native cron job?

A: This tool can handle syntax of “last weekday of month”. For example, you need to send promotion campaign only on last Friday of each month (specified month). In addition you can specify maximum number of iterations and stop date (the date when cron job execution must be stopped). Also sometimes you need to run script only once. i.e. at 2018-01-31 15:00. There is no way to achieve these tasks using native linux cron job implementation without additional bash programming, while this script can easily handle these tasks.

Q: Why I should use this script instead of other online services?

A: Less cost. You pay once and run forever unlimited number of cron jobs, while other online services requires monthly subscription. In addition this script support bash command execution – online service can’t do it.

Changelog

v 1.3 – 2018.06.26

  • Added cron job description field
  • Cron jobs filter is saved in cookies
  • Added possibility to add custom headers in cURL request
  • Shell command support
  • Added regular expression to detect whether cron job was successfully executed
  • Added possibility to clear old logs in batch
  • Added “Save and Run” button
  • Some bug fixes
Already bought?
1. Open protected/config/params.php and add following lines inside array
return [
    ...

    /**
     * Can Setup SSH Process to execute
     */
    'canSetupProcess'=>function_exists('proc_open'),

    /**
     * Number of cURL commands per batch request
     */
    'batchUrl'=>10,

    /**
     * Number of processes per batch execution
     */
    'batchCommand'=>10,
];
2. Execute following SQL queries in database
ALTER TABLE `webcron_schedule` CHANGE COLUMN `cookie` `cookie` MEDIUMTEXT NULL DEFAULT NULL, CHANGE COLUMN `post` `post` MEDIUMTEXT NULL DEFAULT NULL, CHANGE COLUMN `expression` `expression` VARCHAR(30) NULL DEFAULT NULL, ADD COLUMN `description` TEXT NULL DEFAULT NULL AFTER `http_auth_password`, ADD COLUMN `headers` MEDIUMTEXT NULL DEFAULT NULL AFTER `description`, ADD COLUMN `success_if` TEXT NULL DEFAULT NULL AFTER `headers`, ADD COLUMN `fail_if` TEXT NULL DEFAULT NULL AFTER `success_if`, ADD COLUMN `command_type` ENUM ('url', 'command') DEFAULT 'url', ADD COLUMN `success_if_modificator` VARCHAR(20) NULL DEFAULT NULL AFTER `fail_if`, ADD COLUMN `fail_if_modificator` VARCHAR(20) NULL DEFAULT NULL AFTER `success_if_modificator`, ADD COLUMN `timeout` INT(10) UNSIGNED NULL DEFAULT 400 AFTER `fail_if_modificator`, ADD COLUMN `connection_timeout` INT(10) UNSIGNED NULL DEFAULT 20 AFTER `timeout`;

ALTER TABLE `webcron_log` ADD INDEX `ix_added_at` (`added_at` ASC);

3. Remove protected/vendor directory and upload new from archive.

4. Add / replace files:
Modified files:

protected/composer.json
protected/composer.lock
protected/commands/ExecController.php
protected/components/Helper.php
protected/components/switch_column/SwitchAsset.php
protected/components/switch_column/bundle/js/switcher.js
protected/config/curl.php
protected/controllers/CronJobController.php
protected/mail/notification-html.php
protected/mail/notification-txt.php
protected/messages/en-US/app.php
protected/messages/ru-RU/app.php
protected/models/Log.php
protected/models/Schedule.php
protected/models/search/ModelSearch.php
protected/views/cron-job/create_edit.php
protected/views/cron-job/index.php
protected/views/cron-job/log.php
protected/views/cron-job/predict.php
protected/views/cron-job/statistic.php
protected/views/layouts/authorized.php
protected/views/site/index.php
New files:
protected/components/ScheduleProcess.php
protected/controllers/LogController.php
protected/filters/  <- direcotry
protected/filters/RegexModifierFilter.php
protected/views/cron-job/exec-command.php
protected/views/cron-job/exec-url.php.php
protected/views/cron-job/run-command.php
protected/views/cron-job/run-url.php
5. Remove all files/directories from:
  • protected/runtime
  • assets/

6. Done

v 1.2 – 2017.12.11

  • PHP 7 support
  • Mysql 5.7 support
Already bought?
1. Remove ~root/protected/vendor directory and upload new ~root/protected/vendor directory from archive

2. Replace modified files
~root/protected/views/site/index.php
~root/static/css/AdminLTE.min.css
~root/static/css/skin-blue.min.css
~root/static/js/app.js
~root/protected/assets/IonIconsAsset.php
~root/protected/commands/ExecController.php
~root/protected/controllers/SiteController.php
3. Add new config pair in ~root/protected/config/params.php
/**
 * Default value is 16.384. Number of UTF-8 characters to log.
 *
 * If you want to increase this number then you need to run following query in mysql
 * ALTER TABLE `webcron_log` CHANGE `response` `response` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;
 */
'dbLogResponse'=>'16384',

4. Clear following directories:
~root/assets/
~root/protected/runtime/

v 1.2 – 2016.05.06

  • HTTP Basic Authorization support
  • HTML bug fixes
Already bought? 1. Replace listed below files.
~root/protected/bootstrap/AppBootstrap.php
~root/protected/commands/ExecController.php
~root/protected/controllers/CronJobController.php
~root/protected/messages/en/app.php
~root/protected/messages/ru/app.php
~root/protected/models/Schedule.php
~root/protected/views/category/index.php
~root/protected/views/cron-job/create_edit.php
~root/protected/views/cron-job/index.php
~root/protected/views/cron-job/log.php
~root/protected/views/cron-job/predict.php
~root/protected/views/cron-job/run.php
~root/protected/views/cron-job/statistic.php
~root/protected/views/widgets/per-page.php
~root/protected/widgets/PerPage.php
~root/static/css/site.css
2. Run following query into database:
ALTER TABLE `webcron_schedule` ADD COLUMN `http_auth_username` VARCHAR(255) NULL DEFAULT NULL AFTER `max_executions`, ADD COLUMN `http_auth_password` VARCHAR(255) NULL DEFAULT NULL AFTER `http_auth_username`;
3. Clear cache. Open root/protected/runtime/cache/ directory and remove all content.
4. Done

v 1.1 – 2016.04.21

  • Added HTTP cron jobs handler. Read more
  • Added possibility to specify maximum number of iterations and stop date
  • Added clocks
  • Some bug fixes
Already bought? 1. Replace/add listed below files.
~root/protected/bootstrap/EventListener.php
~root/protected/commands/ExecController.php
~root/protected/components/Cron.php
~root/protected/controllers/CronJobController.php
~root/protected/messages/en-US/app.php
~root/protected/messages/ru-RU/app.php
~root/protected/models/Schedule.php
~root/protected/views/cron-job/create_edit.php
~root/protected/views/cron-job/index.php
~root/protected/views/cron-job/log.php
~root/protected/views/cron-job/predict.php
~root/protected/views/cron-job/run.php
~root/protected/views/cron-job/statistic.php
~root/protected/views/layouts/authorized.php
~root/protected/widgets/Alert.php
~root/static/css/site.css

~root/protected/components/ConsoleCommandRunner.php (NEW)
~root/protected/widgets/ClockWidget.php (NEW) 
2. Run following query into database:
ALTER TABLE `webcron_schedule` CHANGE COLUMN `future_execution` `future_execution` TINYINT(1) NULL DEFAULT 1 , ADD COLUMN `stop_at_user` TIMESTAMP NULL DEFAULT NULL AFTER `future_execution`, ADD COLUMN `total_executions` INT(10) UNSIGNED NULL DEFAULT 0 AFTER `stop_at_user`, ADD COLUMN `max_executions` INT(10) UNSIGNED NULL DEFAULT 0 AFTER `total_executions`;
3. Add new parameter into root/protected/config/params.php
<?php
return [
    ...
    'webHandlerKey'=>'',
    ...
];

4. Clear cache. Open root/protected/runtime/cache/ directory and remove all content.
5. Done

v 1.0 – 2016.04.11
Initial version.

by
by
by
by
by
by