0

I am following this guide

and this guide https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-uwsgi-and-nginx-on-ubuntu-16-04

https://www.digitalocean.com/community/tutorials/understanding-systemd-units-and-unit-files

to set up a restart of a flask app service on ubuntu 16.04.

I am using also neo4j and elasticsearch servers.

Which directive to instruct flask app for restarting after that both servers are running, in case of reboot?

1 Answer 1

2

If this is Ubuntu Desktop as opposed to server, you could try using a GUI services manager like BUM. I believe you can manually set triggers for your service. However, if you are setting the trigger conditionally on a host (server) being up, I believe first you'll need to create a script to check the status of the host. Use a script like the one below to check the status of you host and create a file in your tmp directory.

#!/bin/bash

 target=<host>

 count=$(( ping -c 1 $target | grep icmp* | wc -l )

 if [ $count -eq 0 ]) > /tmp/alive.txt


else

    exit

fi

Then set the trigger on your service to run conditionally on the "alive.txt" file being created.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .