Code-server: Enable on Boot? & Not close upon Ansible's exit.

Created on 14 Aug 2019  路  2Comments  路  Source: cdr/code-server

1) is there a way to make code-server run automatically as soon as the server boots up?
.....
2) when i run the script to start the service from ansible the service terminates once ansible playbook is complate is there a way to make it start from ansible and not end when ansble it done?
....

  • Applogies for jaming multiple Questions in 1 issue just dont want to make extra issues.
question

Most helpful comment

Could you create a service that runs code-server and is set to run on startup? For example on ubuntu (just what I use the most) you could create a file in /etc/systemd/system/code-server.service that contains something like this:

[Unit]
Description=A Code-server
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=(user)
ExecStart=(start code-server here using binaries or docker)

[Install]
WantedBy=multi-user.target

And then using:

sudo systemctl start code-server
sudo systemctl enable code-server

to get it to start on boot up. If you are not using Ubuntu, you can find many tutorials for creating startup services on most OS's. If this doesn't work, respond and I will try to help you fix it, or ask on Stack Overflow (as this is not really coder's problem -- unless this is a feature request for a built-in way to do this) Hope this helps!

All 2 comments

Could you create a service that runs code-server and is set to run on startup? For example on ubuntu (just what I use the most) you could create a file in /etc/systemd/system/code-server.service that contains something like this:

[Unit]
Description=A Code-server
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=(user)
ExecStart=(start code-server here using binaries or docker)

[Install]
WantedBy=multi-user.target

And then using:

sudo systemctl start code-server
sudo systemctl enable code-server

to get it to start on boot up. If you are not using Ubuntu, you can find many tutorials for creating startup services on most OS's. If this doesn't work, respond and I will try to help you fix it, or ask on Stack Overflow (as this is not really coder's problem -- unless this is a feature request for a built-in way to do this) Hope this helps!

We already documented this on the quickstart. Closing.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

balazssoltesz picture balazssoltesz  路  3Comments

lshamis picture lshamis  路  3Comments

pchecinski picture pchecinski  路  3Comments

rcarmo picture rcarmo  路  3Comments

infogulch picture infogulch  路  3Comments