May be if we write our own program that act like 'service' and then set PATH to its execute path for System, that could be better. But at this point I am not sure about setting PATH so I can offer only the familiar code only.
Code for C Program could be something like below.
Note: Save file as service.c
Compile with: cc -o service.out service.c
Execute with: ./service.out [start/stop/restart]
include<stdio.h>
int main(int argc, char *argv[]){
//Start exim
if(strcmp(argv[0],"start")){
system("/usr/local/etc/rc.d/exim start");
}
//Stop Exim
else if(strcmp(argv[0],"stop")){
system("/usr/local/etc/rc.d/exim stop");
}
//Restart Exim
else if(strcmp(argv[0],"restart")){
system("/usr/local/etc/rc.d/exim stop");
system("/usr/local/etc/rc.d/exim start");
}
//If the program have more parameter then add your code here..
//..
return 0;
}
Hope it's useful to you all.
If has any method for setting Path to the above program tell me too.
Thanks.