# Using Schedules On The Panel For Restarts & Events

<span style="color: rgb(0, 0, 0);">Head to your panel and click on the server that you need to make the schedule for then click on the "Schedules" tab along the top bar.</span>

<span style="color: rgb(0, 0, 0);">![image.png](https://docs.jasmeow.systems/uploads/images/gallery/2023-10/scaled-1680-/XVmgoqu5ot8B3yzg-image.png)</span>

<span style="color: rgb(0, 0, 0);">Create a new schedule in the bottom right.</span>

<span style="color: rgb(0, 0, 0);">![](https://jasmeow.pics/OfqrVd.png)</span>

<span style="color: rgb(0, 0, 0);">In this window, give the schedule a name, such as "Restart Server". Next, we need to set the time it will restart using the Cronjob syntax. Not sure what this is? In Windows, you might be aware of a tool called "Task Scheduler", and in Linux it's called "Cronjob/Crontab's", basically the exact same system. To schedule a time, you write it in a way of **x x x x x**, looking like this in terminal:</span>

<span style="color: rgb(0, 0, 0);">![](https://jasmeow.pics/JNurL1.png)</span>

<span style="color: rgb(0, 0, 0);">This means I want my script to run at **1AM** each day. The 0 means at the minute 0, the **1** means at **1AM**, the first **\*** means to run every day of the month, the second **\*** means every month and the third **\*** means to run every day of the week.</span>

- <span style="color: rgb(0, 0, 0);">**Show Cheatsheet** - This is helpful to look at common schedule times or you can use a Cronjob calculator to work out what time you want your schedule to run at <span style="color: rgb(35, 111, 161);">[https://crontab.guru/](https://crontab.guru/) </span></span>
- <span style="color: rgb(0, 0, 0);">**Only When Server Is Online** - Only complete the schedule when the server is in a running state, useful for stopping a restart schedule if the server is off for maintenance, causing it boot back up again and possibly causing headache.</span>
- <span style="color: rgb(0, 0, 0);">**Schedule Enabled** - Obvious enough! Turn on and off the schedule so it doesn't run.</span>

<span style="color: rgb(0, 0, 0);">![](https://jasmeow.pics/uEL18l.png)</span>

<p class="callout warning"><span style="color: rgb(0, 0, 0);">This next part gets a little confusing, so please read in depth and don't presume anything, causing an unfortunate mistake. If you have any questions, don't hesitate to ask.</span></p>

<span style="color: rgb(0, 0, 0);">If you click into the schedule after creating it, you will see the below. You will notice three buttons. Edit, which allows you to change the schedule name and when it runs, New Task which adds tasks onto the schedule for them to run in what order of how they are created with delays if specified, and the Delete button in the bottom right to bin the schedule. Click on "New Task".</span>

<span style="color: rgb(0, 0, 0);">![](https://jasmeow.pics/yD42Al.png)</span>

<span style="color: rgb(0, 0, 0);">You will see the below screen, with the "Action" drop down having three options, Send Command, Send Power Action and Create Backup. These options should be relatively easy to understand, with the power action option changing the Payload section to "Stop, Start, Restart and Kill" options.</span>

<span style="color: rgb(0, 0, 0);">For the Time Offset, you set how long after each task it should wait before running it, such as 10 seconds. This will run the schedule at 1AM for example and run the first task immediately, but the next task set to 10 seconds will run 10 seconds later.</span>

<p class="callout warning"><span style="color: rgb(0, 0, 0);">Remember, Time Offset is the time from the **PREVIOUS** task, **NOT** the **FIRST** task. For example, an announcement for a keyall, then **10** seconds later the keyall, and finally **5** seconds later a save-all, would be **0, 10, 5**, not **0, 10, 15**. It's **5** seconds after the previous task, not **15** seconds, accidentally thinking it begins from the first task in the schedule. If you go to the bottom of this documentation, it has an example for a server restart and announcements.</span></p>

<span style="color: rgb(0, 0, 0);">The "Continue On Failure" option is turned on when the task does not run successfully but continues onto the next tasks in the schedule. This is useful for if you programmed the **broadcast** command but your server actually uses **sendbroadcast** for example. Normally leave this toggled off so you can find out why your schedule did not run unless you are certain everything is correct.</span>

<span style="color: rgb(0, 0, 0);">![image.png](https://docs.jasmeow.systems/uploads/images/gallery/2023-10/scaled-1680-/xdSE6KE6F176Rscr-image.png)</span>

<span style="color: rgb(0, 0, 0);">Click "Create Task" in the bottom right. You are now done unless you need to add additional tasks.</span>

<p class="callout info"><span style="color: rgb(0, 0, 0);">An example is provided below basically explaining how to setup an announcement for a reboot of a Minecraft server for **60, 30 10** and **5** second broadcasts, then **a restart** command.</span></p>

<span style="color: rgb(0, 0, 0);">For example, I have an MC server that needs rebooting at 1AM but I want to announce in chat that the server is going down in 60 seconds, 30 seconds, 10 seconds and 5 seconds. After these announcements, reboot the server.</span>

<span style="color: rgb(0, 0, 0);">To do this, I would:</span>

- <span style="color: rgb(0, 0, 0);">put the first "Action" as **Send Command**...</span>
- <span style="color: rgb(0, 0, 0);">With the "Time Offset" being 0...</span>
- <span style="color: rgb(0, 0, 0);">And the "Payload" being **broadcast &amp;e&amp;lReboot in &amp;6&amp;l60 &amp;e&amp;lseconds!**</span>

<span style="color: rgb(0, 0, 0);">And press "Create Task". I would repeat the same steps for each message, putting the Time Offset as **0, 30, 20, 5**, **5**. If you think about it, you are sending the announcements at **0, 30, 20** and **5** seconds after each other of the previous, and **5** seconds after the previous announcement, you are restarting. It looks like the below:</span>

<span style="color: rgb(0, 0, 0);">![](https://jasmeow.pics/UoYpCr.png)</span>

<span style="color: rgb(0, 0, 0);">You can click on "Run Now" in the bottom right to test your schedule and see if it runs successfully. If it runs with no problems, you are good to leave it running and come back to amend later if need be.</span>

<p class="callout warning"><span style="color: rgb(0, 0, 0);">If you run into an issue where your schedule is stuck on "Processing" with a spinning circle, but not actually doing anything, this is due to a service called Pteroq not running properly. This is responsible for running email sending to subusers or reset password requests, schedule timings and other database related tasks. Let us know and we will connect into your system which is hosting the panel and run **systemctl restart pteroq**.</span></p>