aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/sledjchisl/sledjchisl.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c
index 393376e..b4e20f7 100644
--- a/src/sledjchisl/sledjchisl.c
+++ b/src/sledjchisl/sledjchisl.c
@@ -756,7 +756,6 @@ char *getSimName(char *sim)
756 756
757 757
758// Expects either "simXX" or "ROBUST". 758// Expects either "simXX" or "ROBUST".
759// TODO - ROBUST isn't creating it's pid file, bug in ROBUST, it has config for it.
760int checkSimIsRunning(char *sim) 759int checkSimIsRunning(char *sim)
761{ 760{
762 int ret = 0; 761 int ret = 0;
@@ -795,6 +794,8 @@ int checkSimIsRunning(char *sim)
795 d("%s", path); 794 d("%s", path);
796 i = system(path); 795 i = system(path);
797 } 796 }
797 else
798 d("checkSimIsRunning(%s) has PID %s, which is actually running.", sim, pid);
798 } 799 }
799 } 800 }
800 } 801 }
@@ -804,7 +805,12 @@ int checkSimIsRunning(char *sim)
804 free(path); 805 free(path);
805 path = xmprintf("%s/caches/%s.pid", scRoot, sim); 806 path = xmprintf("%s/caches/%s.pid", scRoot, sim);
806 if (0 == stat(path, &st)) 807 if (0 == stat(path, &st))
808 {
809 D("checkSimIsRunning(%s) -> %s is really really running.", sim, path);
807 ret = 1; 810 ret = 1;
811 }
812 else
813 D("checkSimIsRunning(%s) -> %s is not running.", sim, path);
808 814
809 free(path); 815 free(path);
810 return ret; 816 return ret;
@@ -1836,9 +1842,10 @@ gridStats *getStats(MYSQL *db, gridStats *stats)
1836 stats->stats->putstr(stats->stats, "version", "SledjChisl FCGI Dev 0.1"); 1842 stats->stats->putstr(stats->stats, "version", "SledjChisl FCGI Dev 0.1");
1837 stats->stats->putstr(stats->stats, "grid", "my grid"); 1843 stats->stats->putstr(stats->stats, "grid", "my grid");
1838 stats->stats->putstr(stats->stats, "uri", "http://localhost:8002/"); 1844 stats->stats->putstr(stats->stats, "uri", "http://localhost:8002/");
1839// TODO - figure out how to do this. Do this once ROBUST is fixed to actually store it's PID - 1845 if (checkSimIsRunning("ROBUST"))
1840// if (checkSimIsRunning("ROBUST")) 1846 stats->stats->putstr(stats->stats, "gridOnline", "online");
1841 stats->stats->putstr(stats->stats, "gridOnline", "??"); 1847 else
1848 stats->stats->putstr(stats->stats, "gridOnline", "offline");
1842 } 1849 }
1843 else 1850 else
1844 { 1851 {
@@ -1847,9 +1854,13 @@ gridStats *getStats(MYSQL *db, gridStats *stats)
1847 return stats; 1854 return stats;
1848 } 1855 }
1849 1856
1857 I("Getting fresh grid stats.");
1858 if (checkSimIsRunning("ROBUST"))
1859 replaceStr(stats->stats, "gridOnline", "online");
1860 else
1861 replaceStr(stats->stats, "gridOnline", "offline");
1850 if (db) 1862 if (db)
1851 { 1863 {
1852 I("Getting fresh grid stats.");
1853 char *tmp; 1864 char *tmp;
1854 my_ulonglong locIn = dbCount(db, "Presence", "RegionID != '00000000-0000-0000-0000-000000000000'"); // Locals online but not HGing, and HGers in world. 1865 my_ulonglong locIn = dbCount(db, "Presence", "RegionID != '00000000-0000-0000-0000-000000000000'"); // Locals online but not HGing, and HGers in world.
1855 my_ulonglong HGin = dbCount(db, "Presence", "UserID NOT IN (SELECT PrincipalID FROM UserAccounts)"); // HGers in world. 1866 my_ulonglong HGin = dbCount(db, "Presence", "UserID NOT IN (SELECT PrincipalID FROM UserAccounts)"); // HGers in world.