From: Bruce A. <ba...@gr...> - 2003-01-19 02:46:56
|
Hi Tim, > > > I wasn't sure about the usefulness of '%s', but I've just realised that it > > > is necessary if we are to allow Directives to be used with DEVICESCAN as Tim > > > suggested (I think that's a good idea, btw.). > > > > Actually I agree that %s is needed, but don't agree with the reason why. > > It's only needed to indicate where in the command line argument for the > > program to be execed the device name should appear. Eg: > > /usr/sbin/smartctlreplacement %s -a takes -b arguments -c afterwards > > /usr/sbin/dougsscsiutility -a takes -b device -c name -d %s -e midway > > > > But the %s is NOT needed for DEVICESCAN, since internally we always know > > what device we are concerned with. > > But how does the user specify where they want the device name to be > inserted into the exec string, without the %s? I completely agree with this justification for having %s. > I agree that in the case of specific device lines in smartd.conf, the > user could hard code the same device name into the exec string (bit > yukky IMO), but in the case of DEVICESCAN neither the user nor the > called script knows which device tripped the email unless it can be > passed as a parameter... I'm still confused by this latter remark. Since I agree that we need %s for the reason given previously, this is beating a dead horse. So here goes. Supppose that we didn't have the previous reason for including %s. Suppose that we always have (for instance) the convention that the device name was inserted at the end of the exec string. Then there would be no need for %s. Since, within the smartd code, each time that we detect a problem with a device, we ALREADY have the device name internally in cfg->name. So smartd would just do: sprintf(cmdline,"%s %s", users_argument_to_-M_exec, cfg->name); system(cmdline); Thus, the ONLY reason for having %s is the one given above -- that we need a way to indicate where in the command to be execed the device name should go. Cheers, Bruce |