From f73e46b5e6dea0cfc9c6cc32335c73d0aab809be Mon Sep 17 00:00:00 2001 From: Dbroqua Date: Sat, 27 Mar 2021 17:49:44 +0100 Subject: [PATCH] Added scripts for server deployment --- carburants.service | 18 ++++++++++++++++++ cron.sh | 16 ++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 carburants.service create mode 100755 cron.sh diff --git a/carburants.service b/carburants.service new file mode 100644 index 0000000..a9319d8 --- /dev/null +++ b/carburants.service @@ -0,0 +1,18 @@ +[Unit] +Description=API Carburants! +After=network-online.target + +[Service] +Environment="PORT=3666" +Type=simple +User=dbroqua +Group=dbroqua +UMask=007 +WorkingDirectory=/home/dbroqua/carburants/api +ExecStart=yarn start +Restart=on-failure +TimeoutStopSec=300 + +[Install] +WantedBy=multi-user.target + diff --git a/cron.sh b/cron.sh new file mode 100755 index 0000000..a81e342 --- /dev/null +++ b/cron.sh @@ -0,0 +1,16 @@ +#! /bin/bash + +SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" + +cd ${SCRIPTPATH} +mkdir ./public +cd ./public +wget https://donnees.roulez-eco.fr/opendata/jour +unzip jour +mv PrixCarburants_quotidien*.xml gas-stations.xml +rm jour + +cd ../ + +node importGasStations.js +