Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit99b56f9

Browse files
committed
docs: clarify cron attribute format for coder_script resource
- Update cron description to specify 6-field format (seconds minutes hours day month day-of-week)- Fix misleading example that used 5-field Unix format- Add additional cron examples with proper 6-field format- Include inline comments explaining the scheduleFixes#353
1 parentcfa101d commit99b56f9

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

‎docs/resources/script.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,26 @@ resource "coder_script" "code-server" {
4343
})
4444
}
4545
46-
resource "coder_script" "nightly_sleep_reminder" {
46+
resource "coder_script" "nightly_update" {
4747
agent_id = coder_agent.dev.agent_id
4848
display_name = "Nightly update"
4949
icon = "/icon/database.svg"
50-
cron = "0 22 * * *"
50+
cron = "0022 * * *" # Run at 22:00 (10 PM) every day
5151
script = <<EOF
5252
#!/bin/sh
5353
echo "Running nightly update"
54-
sudo apt-get install
54+
sudo apt-get update
55+
EOF
56+
}
57+
58+
resource "coder_script" "every_5_minutes" {
59+
agent_id = coder_agent.dev.agent_id
60+
display_name = "Health check"
61+
icon = "/icon/heart.svg"
62+
cron = "0 */5 * * * *" # Run every 5 minutes
63+
script = <<EOF
64+
#!/bin/sh
65+
echo "Health check at $(date)"
5566
EOF
5667
}
5768
@@ -78,7 +89,7 @@ resource "coder_script" "shutdown" {
7889

7990
###Optional
8091

81-
-`cron` (String) The cron schedule to run the script on. Thisis a cron expression.
92+
-`cron` (String) The cron schedule to run the script on. Thisuses a6-fieldcron expression format:`seconds minutes hours day-of-month month day-of-week`. Note that this differs from the standard Unix 5-field format by including seconds as the first field. Examples:`"0 0 22 * * *"` (daily at 10 PM),`"0 */5 * * * *"` (every 5 minutes),`"30 0 9 * * 1-5"` (weekdays at 9:30 AM).
8293
-`icon` (String) A URL to an icon that will display in the dashboard. View built-in icons[here](https://github.com/coder/coder/tree/main/site/static/icon). Use a built-in icon with`"${data.coder_workspace.me.access_url}/icon/<path>"`.
8394
-`log_path` (String) The path of a file to write the logs to. If relative, it will be appended to tmp.
8495
-`run_on_start` (Boolean) This option defines whether or not the script should run when the agent starts. The script should exit when it is done to signal that the agent is ready.

‎examples/resources/coder_script/resource.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ resource "coder_script" "code-server" {
2828
})
2929
}
3030

31-
resource"coder_script""nightly_sleep_reminder" {
31+
resource"coder_script""nightly_update" {
3232
agent_id=coder_agent.dev.agent_id
3333
display_name="Nightly update"
3434
icon="/icon/database.svg"
35-
cron="0 22 * * *"
35+
cron="0022 * * *"# Run at 22:00 (10 PM) every day
3636
script=<<EOF
3737
#!/bin/sh
3838
echo "Running nightly update"
39-
sudo apt-getinstall
39+
sudo apt-getupdate
4040
EOF
4141
}
4242

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp