archive
This commit is contained in:
20
firefly/postgres/pause/main.c
Executable file
20
firefly/postgres/pause/main.c
Executable file
@@ -0,0 +1,20 @@
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main() {
|
||||
int stat;
|
||||
int sig;
|
||||
sigset_t set;
|
||||
sigemptyset(&set);
|
||||
printf("add signal SIGINT: %i\n", sigaddset(&set, SIGINT));
|
||||
printf("add signal SIGKILL: %i\n", sigaddset(&set, SIGKILL));
|
||||
printf("add signal SIGTERM: %i\n", sigaddset(&set, SIGTERM));
|
||||
sigprocmask(SIG_BLOCK, &set, NULL);
|
||||
printf("Waiting...\n");
|
||||
stat = sigwait(&set, &sig);
|
||||
printf("Wait complete: %i (%i)\n", sig, stat);
|
||||
printf("Backed: %i\n", system("bash /backup.sh"));
|
||||
printf("Bye-bye!\n");
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user