Skip to content

Commit 9414683

Browse files
authored
Create reboot_now.sh
1 parent 8af5763 commit 9414683

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

scripts/reboot_now.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
3+
set_job_status() {
4+
STATUS=$1
5+
6+
JOB_STATUS_PATH="$(dirname "$0")/status"
7+
8+
echo -n "$STATUS" > "$JOB_STATUS_PATH"
9+
}
10+
11+
# Set successful exit status for the job as otherwise it ends in PENDING and
12+
# ultimately FAILED because it shuts down before it gets to the point
13+
# where it reports back
14+
set_job_status "DONE"
15+
16+
reboot
17+
18+
# If the script reaches this point the command failed, and so we re-set the status accordingly
19+
set_job_status "FAILED"

0 commit comments

Comments
 (0)