Can we configure Theia to be runned after reboot using theia.service?

Hi,
Im running Theia with this command:
yarn theia start /home/centos/my-workspace --hostname 0.0.0.0 --port 8080 &

Can you guys show me how i would have to configure theia.service file if its possible?

For nginx is easy:

[Unit]
Description=nginx - high performance web server
Documentation=https://nginx.org/en/docs/
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target

[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/conf/nginx.conf
ExecStart=/usr/sbin/nginx -c /etc/nginx/conf/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID

[Install]
WantedBy=multi-user.target

[original thread by dmirc]

[dmirc]

I tried with cron job. And its so annoying. Simple stuff should work immediate but:

vim /etc/crontab

PATH=/root/.nvm/versions/node/v8.15.1/bin:$PATH

* * * * * root cd /opt/my-app && /root/.nvm/versions/node/v8.15.1/bin/yarn theia start /home/centos/my-workspace --hostname 0.0.0.0 --port 8080 &>/tmp/mycommand.log &

Many things tried, i am always getting error:
/usr/bin/env: node: No such file or directory

btw, command is working from command line runned as root.

[dmirc]

Solved the cron job issue:

vim /etc/crontab

@reboot root “/opt/my-app/start.sh” &>/tmp/mycommand.log &

in bash script:

#!/bin/bash

. $HOME/.bashrc
cd /opt/my-app && /root/.nvm/versions/node/v8.15.1/bin/yarn theia start /home/centos/my-workspace --hostname 0.0.0.0 --port 8080