Remove -k/kill_server option

This commit is contained in:
Julien BLACHE 2009-04-18 17:26:28 +02:00
parent 362db5003b
commit 5e48a8bb6a
1 changed files with 1 additions and 54 deletions

View File

@ -170,7 +170,6 @@ void usage(char *program) {
printf(" -y Yes, go ahead and run as non-root user\n"); printf(" -y Yes, go ahead and run as non-root user\n");
printf(" -b <id> ffid to be broadcast\n"); printf(" -b <id> ffid to be broadcast\n");
printf(" -V Display version information\n"); printf(" -V Display version information\n");
printf(" -k Kill a running daemon (based on pidfile)\n");
printf("\n\n"); printf("\n\n");
printf("Valid debug modules:\n"); printf("Valid debug modules:\n");
printf(" config,webserver,database,scan,query,index,browse\n"); printf(" config,webserver,database,scan,query,index,browse\n");
@ -222,43 +221,6 @@ int load_plugin_dir(char *plugindir) {
return loaded; return loaded;
} }
static int
sigterm_server(char *pidfile)
{
FILE *fp;
pid_t pid;
int ret;
fp = fopen(pidfile, "r");
if (!fp)
{
DPRINTF(E_LOG, L_MAIN, "Failed to open pidfile %s: %s\n", pidfile, strerror(errno));
return -1;
}
ret = fscanf(fp, "%d\n", &pid);
fclose(fp);
if (ret < 1)
{
DPRINTF(E_LOG, L_MAIN, "Failed to get pid from pidfile %s\n", pidfile);
return -1;
}
ret = kill(pid, SIGTERM);
if (ret != 0)
{
DPRINTF(E_LOG, L_MAIN, "Failed to kill pid %d: %s\n", pid, strerror(errno));
return -1;
}
return 0;
}
static int static int
daemonize(int foreground, char *runas, char *pidfile) daemonize(int foreground, char *runas, char *pidfile)
{ {
@ -534,7 +496,6 @@ int main(int argc, char *argv[]) {
int song_count; int song_count;
int force_non_root=0; int force_non_root=0;
int skip_initial=1; int skip_initial=1;
int kill_server=0;
char *db_type,*db_parms,*web_root,*runas, *tmp; char *db_type,*db_parms,*web_root,*runas, *tmp;
char **mp3_dir_array; char **mp3_dir_array;
char *servername; char *servername;
@ -559,7 +520,7 @@ int main(int argc, char *argv[]) {
err_setlevel(2); err_setlevel(2);
config.foreground=0; config.foreground=0;
while((option=getopt(argc,argv,"D:d:c:P:frysiub:Vk")) != -1) { while((option=getopt(argc,argv,"D:d:c:P:frysiub:V")) != -1) {
switch(option) { switch(option) {
case 'b': case 'b':
ffid=optarg; ffid=optarg;
@ -602,10 +563,6 @@ int main(int argc, char *argv[]) {
force_non_root=1; force_non_root=1;
break; break;
case 'k':
kill_server=1;
break;
case 'V': case 'V':
fprintf(stderr,"Firefly Media Server: Version %s\n",VERSION); fprintf(stderr,"Firefly Media Server: Version %s\n",VERSION);
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
@ -625,16 +582,6 @@ int main(int argc, char *argv[]) {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if (kill_server)
{
ret = sigterm_server(pidfile);
if (ret == 0)
exit(EXIT_SUCCESS);
else
exit(EXIT_FAILURE);
}
io_init(); io_init();
io_set_errhandler(main_io_errhandler); io_set_errhandler(main_io_errhandler);
ws_set_errhandler(main_ws_errhandler); ws_set_errhandler(main_ws_errhandler);