aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index a5ab5d9..ea54701 100644
--- a/src/main.c
+++ b/src/main.c
@@ -645,7 +645,7 @@ static void command_sync(int argc, char **argv, char *rss_config_dir, char *html
}
fprintf(stderr, "Overwriting existing %s\n", automedia_pid_path);
- remove(automedia_pid_path);
+ unlink(automedia_pid_path);
pid_file = open(automedia_pid_path, O_CREAT | O_EXCL | O_SYNC | O_RDWR, 0666);
}
@@ -655,20 +655,21 @@ static void command_sync(int argc, char **argv, char *rss_config_dir, char *html
}
signal(SIGINT, automedia_pid_signal_handler);
+ signal(SIGTERM, automedia_pid_signal_handler);
char process_pid_str[32];
snprintf(process_pid_str, sizeof(process_pid_str), "%d", getpid());
int process_pid_str_len = strlen(process_pid_str);
if(write(pid_file, process_pid_str, process_pid_str_len) != process_pid_str_len) {
fprintf(stderr, "Failed to write pid to %s\n", automedia_pid_path);
- remove(automedia_pid_path);
+ unlink(automedia_pid_path);
exit(1);
}
close(pid_file);
const int sync_rate_sec = 15 * 60; /* every 15 min */
sync_rss_html(rss_config_dir, html_config_dir, program_dir, download_dir, sync_rate_sec);
- remove(automedia_pid_path);
+ unlink(automedia_pid_path);
}
static void command_downloaded(int argc, char **argv, const char *rss_config_dir, const char *html_config_dir) {