| 122 | } |
| 123 | |
| 124 | async function notifyServiceManagerReady() { |
| 125 | const socketAddress = Deno.env.get('NOTIFY_SOCKET'); |
| 126 | if (typeof socketAddress !== 'string') { |
| 127 | return; |
| 128 | } |
| 129 | |
| 130 | const result = await (new Deno.Command('systemd-notify', { |
| 131 | args: ['--ready', `MESSAGE=bewCloud is ready`], |
| 132 | })).output(); |
| 133 | if (!result.success) { |
| 134 | const output = new TextDecoder().decode(result.stderr); |
| 135 | throw new Deno.errors.NotCapable(`Failed to execute “systemd-notify”: ${output} (code ${result.code})`); |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | export const abortController = new AbortController(); |
| 140 | |