Megatest

Check-in [b0e72501af]
Login
Overview
Comment:Added server process checking to -list-servers
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.80
Files: files | file ages | folders
SHA1: b0e72501afec3984cb11553cbc5ec86a0081a7d1
User & Date: mmgraham on 2023-09-22 19:31:43
Other Links: branch diff | manifest | tags
Context
2023-09-24
16:33
implemented -kill-servers, improved -list-servers check-in: 46988a2cec user: mmgraham tags: v1.80
2023-09-22
19:31
Added server process checking to -list-servers check-in: b0e72501af user: mmgraham tags: v1.80
19:00
implemented -list-servers check-in: 536d85c6c4 user: mmgraham tags: v1.80
Changes

Modified megatest.scm from [59c2df0c37] to [05c556c928].

983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014

1015
1016
1017
1018
1019
1020
1021
1022
1023
      (adjutant-run)
      (set! *didsomething* #t)))

(if (args:get-arg "-list-servers")
  (let* ((tl (launch:setup))
        (servdir (tt:get-servinfo-dir *toppath*))
        (servfiles (glob (conc servdir "/*:*.db")))
        (fmtstr  "~10a~22a~10a~13a~25a\n")
        (dbfiles (glob (conc *toppath* "/.mtdb/*.db")))
        (ttdat (make-tt areapath: *toppath*))
     )
     (format #t fmtstr "DB" "host:port" "PID" "age (hms)" "Last mod")
     (for-each
        (lambda (dbfile)
          (let* (
            (dbfname (conc (pathname-file dbfile) ".db"))
            (sfiles   (tt:find-server *toppath* dbfname))
            )
            (for-each 
              (lambda (sfile)
                (let (
                  (sinfos (tt:get-server-info-sorted ttdat dbfname))
                  )
                  (for-each 
                     (lambda (sinfo)
                       (let* (
                         (db (list-ref sinfo 5))
                         (pid (list-ref sinfo 4))
                         (host (list-ref sinfo 0))
                         (port (list-ref sinfo 1))
                         (age (seconds->time-string(- (current-seconds) (list-ref sinfo 2))))
                         (last-mod (seconds->string (list-ref sinfo 2)))

                            )
                         (format #t fmtstr db (conc host ":" port) pid age last-mod)
                       )
                     )
                     sinfos
                  )
                ) 
              )
              sfiles







|



|




















>

|







983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
      (adjutant-run)
      (set! *didsomething* #t)))

(if (args:get-arg "-list-servers")
  (let* ((tl (launch:setup))
        (servdir (tt:get-servinfo-dir *toppath*))
        (servfiles (glob (conc servdir "/*:*.db")))
        (fmtstr  "~10a~22a~10a~13a~25a~8a\n")
        (dbfiles (glob (conc *toppath* "/.mtdb/*.db")))
        (ttdat (make-tt areapath: *toppath*))
     )
     (format #t fmtstr "DB" "host:port" "PID" "age (hms)" "last mod" "state")
     (for-each
        (lambda (dbfile)
          (let* (
            (dbfname (conc (pathname-file dbfile) ".db"))
            (sfiles   (tt:find-server *toppath* dbfname))
            )
            (for-each 
              (lambda (sfile)
                (let (
                  (sinfos (tt:get-server-info-sorted ttdat dbfname))
                  )
                  (for-each 
                     (lambda (sinfo)
                       (let* (
                         (db (list-ref sinfo 5))
                         (pid (list-ref sinfo 4))
                         (host (list-ref sinfo 0))
                         (port (list-ref sinfo 1))
                         (age (seconds->time-string(- (current-seconds) (list-ref sinfo 2))))
                         (last-mod (seconds->string (list-ref sinfo 2)))
                         (state (if (system (conc "ssh " host " ps " pid " > /dev/null")) "alive" "dead"))
                            )
                         (format #t fmtstr db (conc host ":" port) pid age last-mod state)
                       )
                     )
                     sinfos
                  )
                ) 
              )
              sfiles