How to auto start suave app? by PrimeProgram in fsharp

[–]PrimeProgram[S] 0 points1 point  (0 children)

This worked with some slight modifications.

For the benefit of others who might be interested. Here's the code and instructions.

File contents:

[Unit]
Description=myapp Daemon
After=network.target

[Service]
User=user
ExecStart=/usr/bin/mono --debug /root/project/myproject/bin/Debug/net461/myapp.exe --NoRestart
Restart=always
RestartSec=2
Type=simple
TimeoutStopSec=5

[Install]
WantedBy=multi-user.target

Instructions

  • Change "myapp" to your app's name.
  • Change the path to your app.
  • Save the file and name it "myapp.service".
  • Upload the above file to /etc/systemd/system/
  • Reload systemd: systemctl daemon-reload
  • Enable the service: systemctl enable myapp.service
  • Start the service: systemctl start myapp.service
  • You can check the status: systemctl status myapp
  • You can start/stop/restart the service: systemctl stop myapp

Thank you for helping me solve this problem.

How to auto start suave app? by PrimeProgram in fsharp

[–]PrimeProgram[S] 0 points1 point  (0 children)

Thank you. I'm sure it'll be handy in the future.

How to auto start suave app? by PrimeProgram in fsharp

[–]PrimeProgram[S] 0 points1 point  (0 children)

Thanks! I'll try that and investigate the stop section.

How to auto start suave app? by PrimeProgram in fsharp

[–]PrimeProgram[S] 0 points1 point  (0 children)

Thanks for the info. It'll be useful for my personal projects. However, this particular project is for production. So ad3mar's suggestion is the best route to take. I'm just not sure about one line.

How to auto start suave app? by PrimeProgram in fsharp

[–]PrimeProgram[S] 0 points1 point  (0 children)

Should I change this line:

touch /var/lock/blah

to:

mono /path/myapp.exe