#!/bin/bash

echo "Start Running projects...";

echo "Start MongoDB" & \
cd ~/monterossa && \
sudo mongod --fork --logpath /var/log/mongod.log --dbpath ~/monterossa/db/ --auth && \

echo "Start Redis" && \
sudo redis-server --daemonize yes --loglevel verbose --logfile /var/log/redis/redis.log && \

echo "Start server" && \
cd ~/monterossa/iarchiv-server && \
sudo -- gulp dev && \

echo "Start client" && \
cd ~/monterossa/iarchiv-client && \
sudo npm run build && \
sudo systemctl restart nginx  && \

echo "Start pdf worker" && \
cd ~/monterossa/iarchiv-pdf-worker && \
sudo -- gulp dev && \

echo "Start unified storage" && \
cd ~/monterossa/iarchiv-unified-storage && \
sudo -- gulp release --fs

echo "Running....";