Open Arlington1985 opened 6 years ago
CC @nightwing
this is my configuration with systemd and tmux, it works very well.
[Unit]
Description=Cloud9 IDE
After=network.target
[Service]
Type=oneshot
RemainAfterExit=yes
User=user
Group=user
ExecStart=/bin/bash -c '\
/usr/bin/tmux has-session -t c9; \
if [ $? -eq 0 ]; then \
echo "c9 already start"; \
else \
echo "start tmux with c9"; \
/usr/bin/tmux new-session -d -s c9 "node <PATH TO server.js> -p <YOUR_PORT> -w <YOUR WORKSPACE> --collab"; \
fi'
ExecStop=/bin/bash -c '\
/usr/bin/tmux has-session -t c9; \
if [ $? -eq 0 ]; then \
echo "stop c9"; \
/usr/bin/tmux kill-session -t c9; \
else \
echo "c9 is not running"; \
fi'
Restart=no
KillMode=none
[Install]
WantedBy=multi-user.target
Would like to share simple script for managing c9 process in your own VPS. Works for me. You need just to replace _YOUR_IP, PORT_NUM, YOUR_USER, YOUR_PASSWORD, PROJECTFOLDER: