Last active
July 24, 2016 12:06
-
-
Save luizperes/a17cfc772e5ac9ee43efc5b7fcd65156 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stddef.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <sys/types.h> | |
#include <signal.h> | |
#include <stdio.h> | |
#define PROGRAM "docker run jaca -a google -u username -p password -l 'Vancouver, British Columbia' -m all -w 25 -c 0" | |
static volatile int keepRunning = 1; | |
void sigintHandler(int signal) | |
{ | |
printf("gule gule\n"); | |
keepRunning = 0; | |
} | |
int main(int argc, char **argv) | |
{ | |
signal(SIGINT, sigintHandler); | |
while (keepRunning) | |
{ | |
int s, signal; | |
printf("fork will start running\n"); | |
pid_t pid; | |
pid = fork(); | |
if (pid == 0) | |
{ | |
// execute the command | |
//execl (PROGRAM, PROGRAM, ARGS); | |
system(PROGRAM); | |
_exit (EXIT_FAILURE); | |
} | |
sleep(5400); | |
kill(pid, SIGTERM); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment