Index: install.sh =================================================================== diff -u -r1c0061afa4b32d33e414c0d3afe5602ed57f122e -r67dac68b5a26c29a1e15ab754977b3fe49ed05ff --- install.sh (.../install.sh) (revision 1c0061afa4b32d33e414c0d3afe5602ed57f122e) +++ install.sh (.../install.sh) (revision 67dac68b5a26c29a1e15ab754977b3fe49ed05ff) @@ -165,8 +165,33 @@ function drt_server_autostart() { # create a symlink for manual execution # TODO create a script to stop/start the service instead of a direct symlink + local RUNSH="run.sh" + cd $DRT_SERVER_DST + local is_running="-n \$(ps aux | grep \"node dist\" | grep -v grep)" + echo -e "#!/bin/bash\n" \ + "\n" \ + "if [[ $is_running ]]; then\n" \ + " echo \"--------------------------------------- DRT Server is running\"\n" \ + " exit 0\n"\ + "fi\n" \ + "\n" \ + " echo \"--------------------------------------- DRT Server starting ...\"\n" \ + "cd $DRT_SERVER_DST\n" \ + "node dist/apps/mt-api/main.js &\n" \ + "sleep 10\n" \ + "if [[ $is_running ]]; then\n" \ + " echo \"--------------------------------------- DRT Server started\"\n" \ + "else\n" \ + " echo \"---------------------------------- ERR: DRT Server start FAILED\"\n" \ + "fi\n" \ + "\n" \ + > $RUNSH + + chmod a+x $RUNSH + cd - ln -s $DRT_SERVER_DST/dist/apps/mt-api/main.js drt + if [ -e drt ]; then rm drt; fi + ln -s $DRT_SERVER_DST/run.sh drt # TODO : add a service to autostart the drt server on each reboot @@ -228,7 +253,8 @@ drt_server_build echo "---------------------------------------- DRT-Server Cleanup" +drt_server_autostart + +echo "---------------------------------------- DRT-Server Cleanup" drt_server_cleanup -exit 0 -