Skip to content

Instantly share code, notes, and snippets.

@GiladShoham
Forked from gbraad/README.md
Last active July 26, 2018 21:20
Show Gist options
  • Save GiladShoham/43b69c4bd64ac73106e57feaed545a75 to your computer and use it in GitHub Desktop.
Save GiladShoham/43b69c4bd64ac73106e57feaed545a75 to your computer and use it in GitHub Desktop.
Start C9 IDE from systemd

Start C9 IDE from systemd

Install Cloud9 first as [username]

$ su - [username]
$ wget https://github.com/gbraad/ansible-playbooks/raw/master/playbooks/install-c9sdk.yml
$ ansible-playbook install-c9sdk.yml

Create service unit /etc/systemd/system/c9.service

[Unit]
Description=Cloud9 IDE
Requires=network.target

[Service]
Type=simple
User=[username]
ExecStart=/home/[username]/.local/bin/c9
Restart=on-failure

[Install]
WantedBy=multi-user.target

Create shell script /home/[username]/.local/bin/c9

#!/bin/sh
USERNAME=""
PASSWORD=""

$HOME/.c9/node/bin/node /home/c9sdk/server.js \
    --listen 0.0.0.0 \
    --port 8181 \
    -a $USERNAME:$PASSWORD \
    -w /workspace
$ sudo -i
$ systemctl daemon-reload
$ systemctl start c9
$ systemctl enable c9

Note: substitute username

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment