Skip to content

Commit e642c95

Browse files
docs: update script.md after rebase
Co-authored-by: matifali <10648092+matifali@users.noreply.github.com>
1 parent e073cc7 commit e642c95

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

docs/resources/script.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ resource "coder_agent" "dev" {
2222
}
2323
2424
resource "coder_script" "dotfiles" {
25-
agent_id = coder_agent.dev.agent_id
25+
agent_id = coder_agent.dev.id
2626
display_name = "Dotfiles"
2727
icon = "/icon/dotfiles.svg"
2828
run_on_start = true
@@ -33,7 +33,7 @@ resource "coder_script" "dotfiles" {
3333
}
3434
3535
resource "coder_script" "code-server" {
36-
agent_id = coder_agent.dev.agent_id
36+
agent_id = coder_agent.dev.id
3737
display_name = "code-server"
3838
icon = "/icon/code.svg"
3939
run_on_start = true
@@ -43,15 +43,26 @@ resource "coder_script" "code-server" {
4343
})
4444
}
4545
46-
resource "coder_script" "nightly_sleep_reminder" {
47-
agent_id = coder_agent.dev.agent_id
46+
resource "coder_script" "nightly_update" {
47+
agent_id = coder_agent.dev.id
4848
display_name = "Nightly update"
4949
icon = "/icon/database.svg"
50-
cron = "0 22 * * *"
50+
cron = "0 0 22 * * *" # 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.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. This is a cron expression.
92+
- `cron` (String) The cron schedule to run the script on. This uses a 6-field cron 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.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy