File tree Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ This script is pretty generic and should be able to run on any OpenRC-based distribution with minimal tweaks.
2
+
3
+ Save the file as ` code-server ` in ` /etc/init.d ` and make it executable with ` chmod +x code-server ` . Put your username in line 3.
4
+
5
+ ``` bash
6
+ name=$RC_SVCNAME
7
+ description=" $name - VS Code on a remote server"
8
+ user=" " # your username here
9
+ homedir=" /home/$user "
10
+ command=" /usr/bin/$name "
11
+ # Just because you can do this does not mean you should. Use ~/.config/code-server/config.yaml instead
12
+ # command_args="--extensions-dir $homedir/.local/share/$name/extensions --user-data-dir $homedir/.local/share/$name --disable-telemetry"
13
+ command_user=" $user :$user "
14
+ pidfile=" /run/$name /$name .pid"
15
+ command_background=" yes"
16
+ extra_commands=" report"
17
+
18
+ depend () {
19
+ use logger dns
20
+ need net
21
+ }
22
+
23
+ start_pre () {
24
+ checkpath --directory --owner $command_user --mode 0755 /run/$name /var/log/$name
25
+ }
26
+
27
+ start () {
28
+ default_start
29
+ report
30
+ }
31
+
32
+ stop () {
33
+ default_stop
34
+ }
35
+
36
+ status () {
37
+ default_status
38
+ report
39
+ }
40
+
41
+ report () {
42
+ # Report to the user
43
+ einfo " Reading configuration from ~/.config/code-server/config.yaml"
44
+ }
45
+ ```
46
+
47
+ Start on boot with default runlevel
48
+ ```
49
+ rc-update add code-server default
50
+ ```
51
+
52
+ Start the service immediately
53
+ ```
54
+ rc-service code-server start
55
+ ```
You can’t perform that action at this time.
0 commit comments