From: Nick Murtagh (murtaghn at domain tcd.ie)
Date: Fri 19 Apr 2002 - 16:07:51 IST
On Friday 19 April 2002 15:18, Stephen_Reilly at domain dell.com wrote:
> Aside: It would be quite easy to write a script which would check
> each rc[].d directory and report the exact on|off|maybe|none state of each
> service for that particular runlevel. Combine that with chkconfig and the
> service script and you could have all sorts of fun.
Well here's a patch against 1.2.23 to make none appear if there aren't any
symlinks. Enjoy =)
diff -uNr chkconfig-1.2.23-orig/chkconfig.c chkconfig-1.2.23/chkconfig.c
--- chkconfig-1.2.23-orig/chkconfig.c Sat Dec 30 04:25:26 2000
+++ chkconfig-1.2.23/chkconfig.c Fri Apr 19 16:03:42 2002
at domain at domain -88,6 +88,7 at domain at domain
static int showServiceInfo(char * name, int forgiving) {
int rc;
int i;
+ int on;
struct service s;
if ((rc = readServiceInfo(name, &s, 0))) {
at domain at domain -103,7 +104,13 at domain at domain
}
for (i = 0; i < 7; i++) {
- printf("\t%d:%s", i, isOn(s.name, i) ? _("on") : _("off"));
+ on = isOn(s.name, i);
+ if (on == 0)
+ printf("\t%d:%s", i, _("off"));
+ else if (on == 1)
+ printf("\t%d:%s", i, _("on"));
+ else
+ printf("\t%d:%s", i, _("none"));
}
printf("\n");
at domain at domain -118,7 +125,7 at domain at domain
return 0;
}
for (i = 0; i < 7; i++) {
- if (isOn("xinetd", i))
+ if (isOn("xinetd", i) == 1)
return 1;
}
return 0;
diff -uNr chkconfig-1.2.23-orig/leveldb.c chkconfig-1.2.23/leveldb.c
--- chkconfig-1.2.23-orig/leveldb.c Tue Jun 12 16:47:36 2001
+++ chkconfig-1.2.23/leveldb.c Fri Apr 19 16:03:08 2002
at domain at domain -403,7 +403,10 at domain at domain
if (findServiceEntries(name, level, &globres))
exit(1);
- if (!globres.gl_pathc || !strstr(globres.gl_pathv[0], "/S"))
+ if (!globres.gl_pathc)
+ return -1;
+
+ if (!strstr(globres.gl_pathv[0], "/S"))
return 0;
globfree(&globres);
diff -uNr chkconfig-1.2.23-orig/ntsysv.c chkconfig-1.2.23/ntsysv.c
--- chkconfig-1.2.23-orig/ntsysv.c Mon Mar 5 05:51:54 2001
+++ chkconfig-1.2.23/ntsysv.c Fri Apr 19 16:03:08 2002
at domain at domain -47,7 +47,7 at domain at domain
} else {
for (j = 0; j < 7; j++) {
if (levels & (1 << j)) {
- if (isOn(services[i].name, j)) break;
+ if (isOn(services[i].name, j) == 1) break;
}
}
checkboxes[i] = newtCheckbox(-1, i, services[i].name,
This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:16:15 GMT