Knowledge Base

How to use and create schedules

Schedules can be extremely handy to automate certain commands or actions from running on your server. It may seem overwhelming to create your own schedule but it is actually quite easy. In this article I will explain how to create your own schedule, explain cronjobs so explain how to schedule a schedule and give some nice examples.

 

How to open the schedules page

To start you want to navigate to the schedules page on your web UI click on schedules.

 

 

 

Now you should see the following this is an overview of the schedules that already exist.

 

 

 

Creating a new schedule

To create a new schedule you will have to press the button that says create schedule.

 

This will open the following window.

Here you have the following options:
 

  • Schedule name: This is the name to give to your schedule, give it an option name so you remember what schedule this is.
  • Time: In Minute, hour, etc you can fill in when the schedule needs to run
  • Show cheat sheet: This will open the following window that will give some examples and explanations on how to schedule using a cronjob
  • Only when server is online: If the schedule should run always or just when the server is online
  • Schedule enabled: Is the schedule enabled or disabled

 

After you did all this and you click create schedule you will now see the schedule in your schedules list.

As you can see I now have a new schedule.

 

How to add a task to the schedule and how to manage your schedules

To add a command to the schedule you have to manage the schedule, to do this click on the schedule you want to manage. This will open up a new window where you can manage the schedule.

here you can see the cronjob you put in, when it was last run, when it will run next and you can even delete the schedule. If you click the edit button it will open a window that should be familiar to you when you created the schedule. But most important is the button new task. 

If you click this button a new window will open up where you can create a new task that is assigned to this schedule. 

 

In this window you have several options.

 

Action: Here you can select 3 options the option is the action that happens when the task is run.Send command: a command will be send to the console

 

Send command:

 If you select send command you can insert a payload in the payload window, this payload is then executed as a command in your server console. So if you give it the payload: “say hello world” your console will say Hello world when the task is executed

Remember, you can only put one command in here, if you add “Say hello world” and on the next sentence “say bye world” the server will say: “Hello world say bye world”

 

Send power action: 
Send power action gives you the option to pick several tasks the server has to perform, it is just like the payload is pre programmed. The tasks you can choose from are start, restart, stop and terminate the server.

 

Create backup: 

A new backup will be created. see more on backups in our guide on backups. 

 

Time offset:

Within this window you can fill in time offset in seconds, what this means is how long the server will wait with executing this task after this schedule has been run. If you add multiple tasks to one schedule, for example your schedule is set to run at 23:55 every day. 

You can create one task where time offset is 0 that sends a command "say server is restarting in 5 minutes.

When you add the second task you want to add 300 seconds in the time offset box this means this task will run 5 minutes after the schedule has been run, so the server will restart 5 minutes after the announcement has been made.

 

Continue on failure

Toggling this button means that if a task fails the other tasks related to the schedule still have to be executed. For example if the first task that was supposed to say the server is restarting in 5 minutes fails the restart will not happen because it will not continue on failure. You can turn this on then the server will restart after 5 minutes when that command has been run, however this can be a nasty surprise for people playing on the server.

How to manage tasks

When you created the tasks you will see the following for example

 

If you click the pencil you will get back in the new task menu for that task and you can change whatever you want. Additionally you can press the garbage bin and delete tasks if you no longer want them.

 

How to use Cronjob syntax for the schedules:

The schedules use a system called cronjob syntax to determine when the schedule will run.

 A cronjob syntax consists of 5 fields, you can fill them in here seperately. 

  • Minute:
  • Hour
  • Day of the month
  • Month
  • Day of the week

 

  • If you fill in just the minute, hour, day etc for example 1  **** the command will run every 1st minute of the hour if it was * 1 *** it would run every first hour of the day
  • If you fill in nothing so   ***** the schedule will run every minute of every hour, of every day etc.
  • If you put a / in there so */5  **** the command will run every five minutes for example, this works the same if you put this in the days, hours etc
  • If you put in multiple numbers seperated by a comma it will run on all the times you put in so 0 3,15  *** your command will run at 3:00 and 15:00 so you can insert multiple hours, minutes or days it needs to run
  • Lastly you can also put a range in there do this by seperating the numbers with a -, so if you do 0 3-15 *** the command will run every hour, on the hour from 3:00 to 15:00
CronjobRuns at
* * * * *Every minute
0 * * * *Every hour
0 4 * * *Daily at 4 AM
*/5 * * * *Every 5 minutes
0 3,15 * * *At 3:00 and 15:00

 

 

Please rate this article to help us improve our Knowledge Base.

0 0

Echonode © All Rights Reserved.