mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-06-12 23:17:02 +02:00
fixed the reload utility
This commit is contained in:
@ -25,7 +25,7 @@ struct __config cfg;
|
||||
|
||||
|
||||
void fatal(char *s){
|
||||
printf("pilerctl: fatal: %s\n", s);
|
||||
syslog(LOG_PRIORITY, "fatal: %s", s);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -35,6 +35,8 @@ int main(int argc, char **argv){
|
||||
int pid;
|
||||
FILE *f;
|
||||
|
||||
(void) openlog("pilerreload", LOG_PID, LOG_MAIL);
|
||||
|
||||
cfg = read_config(CONFIG_FILE);
|
||||
|
||||
f = fopen(cfg.pidfile, "r");
|
||||
@ -46,7 +48,11 @@ int main(int argc, char **argv){
|
||||
|
||||
pid = atoi(buf);
|
||||
|
||||
if(pid > 1) kill(pid, SIGHUP);
|
||||
if(pid > 1){
|
||||
if(kill(pid, SIGHUP) == 0) syslog(LOG_PRIORITY, "reloaded");
|
||||
else syslog(LOG_PRIORITY, "failed to reload");
|
||||
}
|
||||
else fatal("invalid pid");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user