Used to check for browser translation.
用于检测浏览器翻译。
ブラウザの翻訳を検出する
Command Reference

rescue


The blocklet server rescue command is a recovery utility designed to restart blocklets that have stopped running after a specified time. This is particularly useful for bringing blocklets back online after an unexpected server shutdown or crash, saving you from having to restart each one manually.

Usage#

blocklet server rescue --stopped-after <time> [options]

Options#

Option

Description

Required

--stopped-after <time>

A valid timestamp. The command will only attempt to restart blocklets that were stopped after this specific time. The time should be in a format recognized by new Date(), such as an ISO 8601 string (e.g., "2023-10-27T10:30:00Z").

Yes

--force

By default, the command skips blocklets that are already in a running state. Use this flag to force an attempted restart on all targeted blocklets, regardless of their current status.

No

Workflow#

The command follows a specific sequence to determine which blocklets to restart:

No

Yes

Yes

No

Yes

No

No

Yes

Yes

No

Yes

No

Start rescue

Is Blocklet Server running?

Print warning & exit

Get all blocklets

Loop through each blocklet

Is blocklet in dev mode?

Skip

Is blocklet running AND --force is not used?

Was blocklet stopped after the specified time?

Attempt to start blocklet

Start successful?

Show success message

Print error message

Any more blocklets?

Print 'Done!' & exit


Example#

Imagine your server experienced an unexpected reboot around 8:30 AM. You can use the rescue command to restart any production blocklets that went offline.

blocklet server rescue --stopped-after "2023-11-01T08:25:00Z"

This command will scan all blocklets and attempt to restart those that stopped after 8:25 AM UTC on November 1, 2023. It will skip any blocklets in development mode or any that are already running.

Sample Output#

$ blocklet server rescue --stopped-after "2023-11-01T08:25:00Z"
info Skip development blocklet: My Dev Project
info Skip running blocklet: Static Site
info Skip blocklet: Old Archived App because it was not stopped after 2023-11-01T08:25:00Z
⠼ Starting blocklet: Main App
✔ Starting blocklet: Main App
⠼ Starting blocklet: API Service
✖ Failed to start blocklet API Service connect ETIMEDOUT
✔ Done!

In this output, you can see that the command successfully restarted Main App but failed to start API Service. The other blocklets were skipped for the reasons stated.


After running the rescue command, you can verify the outcome by checking the current state of all services with the status command. If any blocklets failed to restart, you can investigate the cause by checking the relevant logs with the logs command.