Skip to content
Snippets Groups Projects
Commit e72913e5 authored by root@science-vs159's avatar root@science-vs159
Browse files

Deployment: robust process

parent 69efc8f1
No related branches found
No related tags found
No related merge requests found
#!/bin/bash #!/bin/bash
# $1: port number to run the server
# $2: filename to log output
PORT="${1:-8080}"
LOG="${2:-out.log}"
LOGPATH="$(pwd)/$LOG"
BACKUPPATH="$(pwd)/$LOG".backup
# Get latest HEAD # Get latest HEAD
git pull origin master git pull origin master
# Build project # Build project
stack build stack build
# Kill previous process # Kill previous process
pkill javawlp immortalctl halt javawlp
# Backup previous log if it exists by appending it to a backup file. # Immortal will automatically restart the new process
if [ -f "$LOGPATH" ]
then
cat "$LOGPATH" >> "$BACKUPPATH"
rm "$LOGPATH"
fi
# Run server
nohup stack exec javawlp -- --runServer -p $PORT > $LOG &
\ No newline at end of file
cwd: /root/javawlp
cmd: stack exec javawlp -- --runServer -p 8080
log:
file: /root/javawlp/output.log
age: 86400
num: 7
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment