proti0070 commited on
Commit
ef22742
·
verified ·
1 Parent(s): 9c55759

Update healthcheck.sh

Browse files
Files changed (1) hide show
  1. healthcheck.sh +14 -6
healthcheck.sh CHANGED
@@ -1,8 +1,16 @@
1
  #!/bin/bash
2
- # Simple HTTP server on port 7860 for HF Spaces health check
3
- # Without this HF marks the Space as failed
 
4
 
5
- while true; do
6
- echo -e "HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nConnection: close\r\n\r\nPostgreSQL is running on port 5432\nDB: xroagent\nUser: xroagent" \
7
- | nc -l -p 7860 -q 1
8
- done
 
 
 
 
 
 
 
 
1
  #!/bin/bash
2
+ # Simple HTTP server using Python (always available in Ubuntu)
3
+ python3 -c "
4
+ import http.server, socketserver
5
 
6
+ class Handler(http.server.BaseHTTPRequestHandler):
7
+ def do_GET(self):
8
+ self.send_response(200)
9
+ self.end_headers()
10
+ self.wfile.write(b'PostgreSQL is running on port 5432')
11
+ def log_message(self, format, *args):
12
+ pass
13
+
14
+ with socketserver.TCPServer(('', 7860), Handler) as httpd:
15
+ httpd.serve_forever()
16
+ "