repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

Eric Bower · 08 Jul 24

pgs-ssh-pprof.diff

 1diff --git a/pgs/ssh.go b/pgs/ssh.go
 2index 4d6b097..0bfb1cf 100644
 3--- a/pgs/ssh.go
 4+++ b/pgs/ssh.go
 5@@ -3,6 +3,7 @@ package pgs
 6 import (
 7 	"context"
 8 	"fmt"
 9+	"net/http"
10 	"os"
11 	"os/signal"
12 	"syscall"
13@@ -113,9 +114,14 @@ func StartSshServer() {
14 		return
15 	}
16 
17+	logger.Info("starting SSH server on", "host", host, "port", port)
18+
19+	go func() {
20+        logger.Error("pprof", "err", http.ListenAndServe("0.0.0.0:6060", nil))
21+    }()
22+
23 	done := make(chan os.Signal, 1)
24 	signal.Notify(done, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
25-	logger.Info("starting SSH server on", "host", host, "port", port)
26 	go func() {
27 		if err = s.ListenAndServe(); err != nil {
28 			logger.Error("serve", "err", err.Error())