diff options
author | Marius Halden <marius.h@lden.org> | 2015-11-26 22:34:27 +0100 |
---|---|---|
committer | Marius Halden <marius.h@lden.org> | 2015-11-26 22:34:27 +0100 |
commit | cf04e4f8e98df62a361bcddfdd56e0a661f4e7b0 (patch) | |
tree | a347b0d59586e59bb8d1d99fcd9f02b572880b79 /supervise.c | |
download | svcmon-cf04e4f8e98df62a361bcddfdd56e0a661f4e7b0.tar.gz svcmon-cf04e4f8e98df62a361bcddfdd56e0a661f4e7b0.tar.bz2 svcmon-cf04e4f8e98df62a361bcddfdd56e0a661f4e7b0.tar.xz |
Initial
Diffstat (limited to 'supervise.c')
-rw-r--r-- | supervise.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/supervise.c b/supervise.c new file mode 100644 index 0000000..3bae8cf --- /dev/null +++ b/supervise.c @@ -0,0 +1,21 @@ +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <errno.h> +#include <err.h> + +char *const run_path[] = { "./run", NULL }; + +int +main(int argc, char **argv) +{ + if (argc != 2) + errx(1, "Usage: %s <dir>\n", argv[0]); + + if (chdir(argv[1]) == -1) + err(1, "chdir()"); + + execv(run_path[0], run_path); + + return 0; +} |