Ubuntu

Start App as a Service

DGWropTx0r9qZasrx4DBOI34qd9bROVyeuyDscLMzm8 - Start App as a Service
DGWropTx0r9qZasrx4DBOI34qd9bROVyeuyDscLMzm8 - Start App as a Service

I am new to Linux and running a home automation server on Ubuntu. I setup this app (link below) and since it is not a service, the app dies at restart. How can i get this to run as a service? I assume i should be using systemd to do so. Just dont know what the .service file should include and i dont know where the cast-web-api execution path is.

Application install / link – [https://vervallsweg.github.io/cast-web/installation-cast-web-api/](https://vervallsweg.github.io/cast-web/installation-cast-web-api/) (expand the mac OS section further down the page)

Sorry in advance. Im a 20 year+ Windows guy. Dont kill me ha ha.


View Reddit by neminatView Source
Sending
User Review
0 (0 votes)

1 Comment

Click here to post a comment

  • And i got it!

    ​

    for those that are find this in a search someday. I dont know anything about linux and there could be bad advise or possible security issues with this. I flat out dont know.

    I created a file named cast-web-api@yourusername.service (use your actual username) and placed it in /etc/systemd/system. Here are the details of the file. I took this from the home automation platform’s installation instructions and replaced the execution path. nameit=whatever name you want for it. I was able to get the execution path when i ran the forever start command in my original link. It spit that out at the end and i was like BINGO!!

    After creating the file i ran the following .

    Make it executable:

    chmod u+x /path/to/spark/sbin/start-all.sh

    Start it:

    sudo systemctl start myfirst

    ​

    Enable it to run at boot:

    sudo systemctl enable myfirst

    ​

    Stop it:

    sudo systemctl stop myfirst

    ​

    I then rebooted. Again the file i created containes the info below.

    [https://www.home-assistant.io/docs/autostart/systemd/](https://www.home-assistant.io/docs/autostart/systemd/)

    File Contents

    [Unit]
    Description=nameit
    After=network-online.target

    [Service]
    Type=simple User=%i
    ExecStart=/usr/bin/cast-web-api

    [Install]
    WantedBy=multi-user.target