Skip to content

Instantly share code, notes, and snippets.

@luizperes
Last active July 24, 2016 12:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luizperes/a17cfc772e5ac9ee43efc5b7fcd65156 to your computer and use it in GitHub Desktop.
Save luizperes/a17cfc772e5ac9ee43efc5b7fcd65156 to your computer and use it in GitHub Desktop.
#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