Skip to content

Commit

Permalink
Split build and copy scripts, now logging fatal errors on main http s…
Browse files Browse the repository at this point in the history
…erve func
  • Loading branch information
nrm21 committed Feb 25, 2023
1 parent 1ff0767 commit f8404f8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
13 changes: 7 additions & 6 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,9 1,10 @@
#!/bin/bash

#rsync -crv nate@workdawg1:/home/nate/cephfs/linux/programming/goinverter /opt
#go build -o ./bin/goinverter ./src
PREVDIR=$(pwd)
cd /opt/goinverter

# ensure id_rsa pub/priv files in C:\Users\Nate\.ssh first
ssh pidawg2 "rm -rf /opt/goinverter/src/*"
scp -r C:/Users/Nate/go/src/_nate/goinverter/src pidawg2:/opt/goinverter/
#ssh pidawg2 "chmod 755 /opt/goinverter/.git && chmod 755 /opt/goinverter/bin && chmod 755 /opt/goinverter/src"
go build -o ./bin/goinverter.new ./src
mv /opt/goinverter/bin/goinverter /opt/goinverter/bin/goinverter.bak
mv /opt/goinverter/bin/goinverter.new /opt/goinverter/bin/goinverter

cd $PREVDIR
6 changes: 6 additions & 0 deletions copy-src.sh
Original file line number Diff line number Diff line change
@@ -0,0 1,6 @@
#!/bin/bash

# ensure id_rsa pub/priv files in C:\Users\Nate\.ssh first
ssh pidawg2 "rm -rf /opt/goinverter/src/*"
scp -r C:/Users/Nate/go/src/_nate/goinverter/src pidawg2:/opt/goinverter/
#ssh pidawg2 "chmod 755 /opt/goinverter/.git && chmod 755 /opt/goinverter/bin && chmod 755 /opt/goinverter/src"
3 changes: 2 additions & 1 deletion src/goinverter.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"log"
"math"
"net/http"
"os"
Expand Down Expand Up @@ -187,5 188,5 @@ func main() {
go handleUSBTraffic()

fmt.Println("Server started at port " httpPort)
http.ListenAndServe(":" httpPort, nil)
log.Fatal(http.ListenAndServe(":" httpPort, nil))
}

0 comments on commit f8404f8

Please sign in to comment.