Skip to main content

How to Cron Job in CentOS 7/8

 A cron job is scheduled operation which can execute a script or an API at any defined interval.

To create a cron job in a CentOS Server you’ll need to edit a file called CronTab.

CronTab is a configuration file that contained commands that are read by Cronie, a command scheduler that is supposedly already installed in your CentOS server.

To edit the crontab file,

EDITOR=nano crontab -e

To creadte a scheduled task in Cron,

* * * * ping http://www.example.com

The first 5 fields of a crontab command define

  • minute (0-59)
  • hour (0-23)
  • day of the month (1-31)
  • month (1-12)
  • day of the week (0-6)

An asterisk, * in a time runs the command at every valid value.
After first five field that define the schedule, next field is a shell command that is supposed to be executed.

Example,
To ping a web address at every minute,

* * * * ping http://www.example.com

To run a php script at every 2 minutes

*/2 * * * * php /var/www/html/myscript.php

To hit an GET REST API every week

0 0 * * 0 curl https://example.com/api/some_api

You can test out the required fields values for creating a schedule on crontab.guru

Some of the examples for creating a schedule

  • * * * * * – Runs the command every minute.
  • 12 * * * * – Runs the command 12 minutes after every hour.
  • 0,15,30,45 * * * * – Runs the command every 15 minutes.
  • */15 * * * * – Runs the command every 15 minutes.
  • 0 4 * * * – Runs the command every day at 4:00 AM.
  • 0 4 * * 2-4 – Runs the command every Tuesday, Wednesday, and Thursday at 4:00 AM.
  • 20,40 */8 * 7-12 * – Runs the command on the 20th and 40th minute of every 8th hour every day of the last 6 months of the year.

Comments

Popular posts from this blog

Unity Mobile Game Optimization Checklist

- On Image and Text components that aren’t interacted with you can uncheck “Raycast Target” on it, as it will remove them from any Raycast calculus. - Click on your textures in your “Project” window. Click on the “Advanced” arrow, and now check “Generate Mip Maps”, Unity especially recommends it for faster texture loading time and a lower rendering time. - Set the “Shadow Cascades” to “No Cascades” (Quality settings) - If you have dynamic UI elements like a Scroll Rect with a lot of elements to visualize, a good practice is to turn off the pixel perfect check box on the canvas that contains the list and disable the items that aren’t visible on the screen. - Set all non moving objects to "Static" - Above Unity3d 2017.2 you should turn off "autoSyncTransforms" on the Physics tab - Always use Crunch Compression Low on textures - Try to keep the “Collision Detection Mode” on “Discrete” if possible, as “Dynamic” demands more performance. - You can go to the TimeManager w...

How to make RPC in Unreal Engine Steam Online Subsystem and EOS

Remote Procedure Calls, also known as RPCs, are a way to call something on any other instance.  In the Unreal Engine, RPCs are used to ship events from the patron to the server, the server to the customer, or from the server to a specific group. It's important to word that RPCs cannot have a return cost. If you want to return something, you'll ought to use a seconds RPC within the contrary path. There are precise policies that RPCs observe, which are unique in the official Documentation. Some of these regulations encompass wherein the RPC must be run, such as the server instance of an Actor, on the owner of the Actor, or on all instances of the Actor. There are some necessities for RPCs. First, they must be referred to as on Actors or replicated Subobjects. The Actor (and component) have to additionally be replicated. If the server is looking an RPC to be executed on a customer, handiest the patron who owns that Actor will execute the function. Similarly, if a client is calling...

How to fix clothes flickering in Unreal Engine 5.

 This issue can be noticed some of the character clothes when using Paragon Characters in UE5. To fix the flickering issue, Use Self Collisions checkbox in collisions properties under the Static Mesh option of your character. Open the character model go to   Asset Details > Clothing Properties - Cloth Config - ChaosClothConfig - Collision Properties - Use Self Collisions > False