blob: 6548fa220018d277e2fd9c41b1c3aa543e14179c [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001#!/bin/sh /etc/rc.common
2
3# Copyright 2020 Google LLC.
4# Copyright (C) 2021 CZ.NIC z.s.p.o. (https://www.nic.cz/)
5# SPDX-License-Identifier: Apache-2.0
6
7USE_PROCD=1
8START=80
9
10start_service() {
11 local state_file
12 local port
13 local std_err std_out
14
15 config_load tailscale
16 config_get_bool std_out "settings" log_stdout 1
17 config_get_bool std_err "settings" log_stderr 1
18 config_get port "settings" port 41641
19 config_get state_file "settings" state_file /etc/tailscale/tailscaled.state
20
21 /usr/sbin/tailscaled --cleanup
22
23 procd_open_instance
24 procd_set_param command /usr/sbin/tailscaled
25
26 # Set the port to listen on for incoming VPN packets.
27 # Remote nodes will automatically be informed about the new port number,
28 # but you might want to configure this in order to set external firewall
29 # settings.
30 procd_append_param command --port "$port"
31 procd_append_param command --state "$state_file"
32
33 procd_set_param respawn
34 procd_set_param stdout "$std_out"
35 procd_set_param stderr "$std_err"
36
37 procd_close_instance
38}
39
40stop_service() {
41 /usr/sbin/tailscaled --cleanup
42}