DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Cover image for Now you can run a code-server as a service.
Ionut aka BlitzCloud
Ionut aka BlitzCloud

Posted on

Now you can run a code-server as a service.

As I mentioned in my last article, I said that code-server lacks a service to run it in the background or at startup. I build a systemd service to solve this issue.

If you want to have the code-server running n the background just follow this steps:

  • Just create this file with your favorite text editor.
/etc/systemd/system/code-service.service
Enter fullscreen mode Exit fullscreen mode
  • Paste the code below.
[Unit]
Description=Code-Server Service
After=network.target

[Service]
Type=simple
Restart=always
User= yourUser
ExecStart=/usr/local/bin/code-server

[Install]
WantedBy=multi-user.target
Enter fullscreen mode Exit fullscreen mode
  • Start the service
sudo service code-server start
Enter fullscreen mode Exit fullscreen mode
  • Check the status
sudo service code-server status
Enter fullscreen mode Exit fullscreen mode
  • Optional enable the process at startup
sudo systemctl enable code-server
Enter fullscreen mode Exit fullscreen mode

Now you should be able to take you safe development environment on your iPad or on your grandma slow computer,without being afraid that the server will stop.

Top comments (0)

DEV

Thank you.

Β 
Thanks for visiting DEV, we’ve worked really hard to cultivate this great community and would love to have you join us. If you’d like to create an account, you can sign up here.