# Schedules

<figure><img src="https://1352697161-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fq2BYmWTMiaonrEL8QBP2%2Fuploads%2F3nDmcOJPVf9U4zebeETl%2Fimage.png?alt=media&#x26;token=1f8c1f61-905d-4449-84db-f2b4ab9389b3" alt=""><figcaption></figcaption></figure>

Schedule มีรายละเอียดข้อมูลดังนี้

* **Status**: สถานะของ Schedule แบ่งเป็น
  * **Active**: Schedule ยังรอการทำงานถัดไปอยู่ เช่น Schedule ที่มี occurrence เป็น repeat
  * **Inactive**: Schedule ที่จะไม่ทำงานอีกแล้ว เช่น Schedule ที่มี occurrence เป็น one-time ที่ทำงานเสร็จแล้ว
* **Action**: กิจกรรมที่ทำกับ resource ของ NIPA Cloud Space
* **Target**: resource ที่จะถูกทำตาม event
* **Occurrence**: รูปแบบการทำงานของ Schedule แบ่งเป็น
  * **One-time**: ตั้งเวลาทำล่วงหน้าแค่ครั้งเดียว
  * **Repeat**: ตั้งเวลาทำซ้ำไปเรื่อยๆ
* **Repeatability**: แสดงสำหรับ Schedule ที่มี occurrence เป็น repeat แสดงรูปแบบการทำซ้ำของ Schedule
* **Next Run Job**: เวลาที่ Schedule จะ run ครั้งถัดไป

## Actions

กิจกรรมที่สามารถตั้งเป็น schedule ได้&#x20;

1. **Start Compute Instance**: ตั้งเวลาให้ระบบทำการ Start ที่ Compute Instance(s) ที่อยู่ใน status Shutoff ที่เลือกไว้
2. **Stop Compute Instance**: ตั้งเวลาให้ระบบทำการ Stop ที่ Compute Instance(s) ที่อยู่ใน status Active ที่เลือกไว้
3. **Restart Compute Instance**: ตั้งเวลาให้ระบบทำการ Restart ที่ Compute Instance(s) ที่อยู่ใน status Active ที่เลือกไว้

## FAQ

1. **Q**: Schedule ทำงานไม่สำเร็จเกิดจากอะไร?\
   **A**: Schedule ทำงานไม่สำเร็จเกิดได้จากหลายสาเหตุ เช่น
   * หา Resource ไม่พบ เช่น Resource ถูกลบออกไปก่อนการ Execute Schedule
   * Status ของ Resource ไม่ยอมให้ทำ Action ที่กำหนดไว้ เช่น&#x20;
     * ไม่สามารถสั่ง Start Compute Instance ได้ หาก Compute Instance Active อยู่แล้ว หรือ อยู่ในสถานะ Error
   * ยอดเงินใน Wallet ไม่เพียงพอ หรือ มียอดค้างชำระมากกว่าที่กำหนด
   * User ที่เป็นผู้สร้าง Schedule ไม่ได้อยู่ใน Project แล้ว ทำให้ไม่มีสิทธิทำ Action ที่กำหนด
2. **Q**: Schedule เปลี่ยนสถานะเป็น Inactive เกิดจากอะไร?\
   **A**: Schedule เปลี่ยนสถานะเป็น Inactive เกิดได้จากหลายสาเหตุ เช่น
   1. Execute Schedule แล้ว ไม่พบ Target Resource ที่กำหนดไว้ เช่น Resource ทั้งหมดถูกลบไปจาก Project แล้ว
   2. Execute Schedule แล้ว พบว่าสิทธิการทำงานของ Schedule ใช้ไม่ได้ จากที่ User ผู้สร้าง Schedule ไม่ได้อยู่ใน Project
3. Q: Schedule ที่ Inactive ไปแล้ว สามารถกลับมาทำงานได้หรือไม่?
4. A: Schedule ที่ Inactive ไปแล้ว จะไม่กลับมาทำงานอีก สามารถลบ และสร้าง Schedule ใหม่ได้ทันที


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-epc.gitbook.io/ncs-documents/scheduling/schedules.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
