← Back to EasyCron.com
Showing posts with label cron job. Show all posts
Showing posts with label cron job. Show all posts

Aug 10, 2020

One-time cron job

Running one-off cron jobs is necessary in many scenarios, such as triggering a one-time alarm, handling subsequent processing after an event, etc..

In standard implementations of cron, the year field is not included in cron expression. Without introducing new tool (such as "at" command), scheduling a one-off cron job could be troublesome and confusing under those circumstances.

The bother involves adding a cron job and waiting for it to be triggered, and then "remembering" to delete it manually on time before next year's execution. Some may use an automatic method to delete the cron job once it's executed, but deleting it automatically could create a false impression that the cron job was never added and executed.

To completely solve the problem, free our users from all those hassles they could encounter and let them can still utilize the power of cron expression, EasyCron added the year field to the cron expression. The implementation is clean, causing no confusion, and no additional action is required to take after cron job execution to achieve running cron job once.

Furthermore, after the cron job is executed, just as inspecting a regular cron job, you could check a one-time cron job's execution result on EasyCron at any time to troubleshoot possible issue.

We hope that the new capabilities that the "year" field brought help.

Jun 15, 2020

Added "year" field support in cron expression

We're exited to announce that EasyCron supports "year" field in cron expression now. By appending a year field to the end of your cron expression, EasyCron will only run your cron job during the specified year(s).

In the year field, you could use values "1970" to "2099" with special characters ", - * /".

For more information about "year" field details, please refer to our cron expression guide.

Beside using cron expression directly, you could also specify execution year(s) by choosing years manually in our cron job creating/editing UI too as the screenshot below.

Choose Execution Years Manually for Cron Job

Aug 12, 2019

Slack Notifications for Cron Jobs

Considering many developers and cron job users use Slack heavily as communication tool in their daily work, we added Slack notification to our service.

Setting up Slack notifications for your cron jobs is easy. Here are the steps it will take:

  1. In the cron job creating/editing form -> tab "Notifications" -> "Slack", choose the notification timings and the notifying sensitivity,
  2. following the guide at Slack to get a URL (with a format of https://hooks.slack.com/services/xxx/yyy/zzz), and paste this URL into the "Slack URL" field. The Slack notification part is done.

Below is a screenshot for Slack notification interface:


Slack Notifications for Cron Job

Nov 3, 2018

EasyCron New UI Launched

We're proud to say that recently we launched an entire new UI with functionality updates.

The front end of our site is now neat and could be loaded faster.


EasyCron New Front End

The back end also got a complete rebuild. Users can now easily click into category of "enabled", "disabled" cron jobs, or a particular group of cron jobs easily from the home page's left sidebar. In the cron job list page of any category or group, you may navigate cron jobs by page, search/reorder cron jobs. These new functionality and flexibility will greatly help you find and configure your cron jobs.


EasyCron New Back End

Our whole site (including front end and back end) is mobile friendly now. We introduced all necessary responsibility technologies to make the site look and work perfectly in mobile devices (from small screen cellphone to medium screen Xpad and large screen desktop).


EasyCron New Mobile Front End

EasyCron New Mobile Back End

Stay tuned, more exciting updates are coming :)

Mar 23, 2018

Output regexp matching

In some cases, you may want to determine the success (or failure) of cron job execution by the content of the output responded from your cron job script (not only by the HTTP code).

With the new feature we introduced today, you can now use regexp to match the output (HTTP message body), and then judge if the cron job execution is successful.


Output regexp matching

As you can see in the screenshot, there are 3 options you could choose from as the condition for your execution to be considered as succeeded or failed:

  • When the HTTP Status is 2xx, consider succeeded. (This is the default option)
  • When the HTTP Status is 2xx, consider succeeded if the HTTP message body matches a specified regular expression.
  • When the HTTP Status is 2xx, consider failed if the HTTP message body matches a specified regular expression.

After above 3 new options were added, the complete rules for judging success or failure are:

  1. Consider failed when the HTTP Status is NOT 2xx (e.g. 200, 201, etc.).
  2. When the HTTP Status is 2xx, check above 3 options.

For the sake of simplicity and matching performance, we use Google re2 as the regexp engine.

Hope that the new feature rocks for you.

Jan 21, 2018

Execution logs enhanced

We recently made some changes to the way we trim and save execution logs.

In the past, in additional to cron job ID, scheduled time to execute, trigger time, done time, cost time and HTTP status, up to 10 KB of output (includes HTTP headers and HTTP message body) responded from your cron job script will be saved for each execution.

Now, the log output part saved in new way will contain:

  • up to 10 KB of HTTP headers, plus
  • up to 20 KB (5 KB for individual plans) of head of the HTTP message body, plus
  • a line of text (example: 1200 Characters Stripped) inserted by EasyCron indicating how many characters were stripped (if the whole HTTP message body is longer than the log length limit of your plan), plus
  • up to 20 KB (5 KB for individual plans) of tail of the HTTP message body.

We hope that the new logs will provide more information you need and help you better understand the overall response from your cron job scripts.

Jan 5, 2018

Cron job execution tracking

Want to know if your cron job has been triggered or not before it's done and its log is saved? Now you're able to do it with our new feature "cron job execution tracking".

With cron job execution tracking, when your cron job has been triggered and is running, your will see an "executing" line immediately in the logs of this cron job telling you that it's executing, like screenshot below:


Cron job execution tracking

This is extremely useful for your awareness of that the cron job has been successfully fired. So that you don't need to worry about you miss the cron job trigger time.

May 13, 2017

Placeholders you could use in cron job URL

EasyCron added placeholder support in cron job URL today.

You could use placeholders:
__RANDOM__
__TIMESTAMP__
in your cron job URL.

__RANDOM__ will be replaced with a random 12-digit integer when your cron job is fired.
And __TIMESTAMP__ will be replaced with unix timestamp.

For example, URL
http://www.example.com?__RANDOM__
could finally be http://www.example.com?123456789000 when it's fired.

Random integer or timestamp in URL will prevent EasyCron's requests from hitting cache in your proxy or server.

Nov 11, 2015

Exporting Cron Jobs in EasyCron

We're happy to announce a new feature which is very useful and can keep our users' mind in peace: Cron Job Exporting.

Now you could down a full backup of your cron jobs added in EasyCron with several clicks.

To do it, just log in and go to "My Account" page, and then click on "Export Cron Jobs" tab, click on "Export my cron jobs" link. A CSV (Comma-Separated Values) file including all your cron job details will be downloaded to your computer.

Currently, cron job details of

  • Cron Job Name,
  • Expression,
  • URL,
  • Email Me (notification setting),
  • Log (execution logging setting),
  • Cookies (cookie variable names and values),
  • POST (post variable names and values),
  • Status (cron job status)
are included in the CSV file.

Drop us a line if you have any advice for the new feature.

Aug 7, 2013

How to test if your cron job is correctly set

After setting up a cron job on server, you may want to know if the cron job was correctly configured, and if the execution date and time will be same as you assume.

To make sure your cron job has correct trigger date and time, you can use our cron job execution time predictor.

To generate a working crontab line, you may use our crontab generator.

After you add the cron job to the system, if you're an idealist, you may also want to test if the cron job really work.

To test the cron job you added, put the following PHP code into a PHP file, upload it to your server. Upload another text file named "output.txt" (make sure you have "write" permission to it). Set up a cron job to trigger the PHP file.

<?php
define('TIMEZONE', 'UTC');
date_default_timezone_set(TIMEZONE);

$fh = fopen('/home/xxx/public_html/output.txt', 'a');
echo $fh;
echo fwrite($fh, date('Y-m-d H:i:s', time()) . "\r\n");

fclose($fh);

?>

When the scheduled time pasts, you may check if output.txt was written with some content. If it did, congratulations! Your cron job is working perfectly.

Jul 15, 2013

Updates to cron job UI and API

We allow users using three ways to specify cron jobs' execution time from now on:

New UI to configure cron job
New UI to configure cron job

As you can see in above screenshot (highlighted in green), you can specify when to execute your cron jobs:

  • By time interval

    You may set cron job's execution time interval easily by choosing an option:
    Set up cron job by execution interval
    Set up cron job by execution interval
    EasyCron will generate a Cron expression for your cron job. The final execution date and time of your cron job will meet your interval setting, with a random starting time. For example, for a cron job run every 10 minutes, the final Cron expression we generated could be 0/10 * * * *, or 6/10 * * * *, the latter means, the cron job starts running at "06" minute, and then be triggered every 10 minutes.
  • By entering a Cron expression directly

    We support standard Cron expression that used in several mainstream Cron implements (Cronie, Vixie cron and Quartz java scheduler, etc.). If you already have Cron expressions for your cron jobs, or you're adept at writing them, this could be a convenient yet powerful way to specify execution time of your cron jobs.
    Besides general specicial characters, EasyCron also supports "R" character in cron expression. "R" is defined by EasyCron for specifying random execution time of cron jobs. To see details of its usage, you may check our Random Cron Job section.
  • Choose manually

    Choose execution times and dates of cron job
    Choose execution times and dates of cron job
    This is a intuitional way to configure dates and times to run your cron jobs. No matter you're a novice or an expert, you'll find the interface helpful. It supports all special chars including "R".

We also updated our API to adapt the cron expression improvement:

  • Parameter changes:

    Simplifying parameters of queries, using only one paramter (cron_expression) to indicate the run time of a cron job instead of 5 (minute, hour, day, month, weekday).
  • Error message changes:

    Changed some error messages.
For more details, please checkout our API document page.
Hope that anyone will enjoy the extremely easier process of managing cron jobs. If you have any suggestion, feel free to leave a message at our contact page.