Unverified Commit af2f3019 authored by Dapa's avatar Dapa Committed by GitHub

Create daemon.cpp

parent bdde792e
#include <iostream>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
#include <string>
using namespace std;
int command(const char *cmd) {
int pid, status;
if ((pid = fork())) {
waitpid(pid, &status, 0);
} else {
execl("/bin/bash", "/bin/bash", "-c", cmd, NULL);
}
return status;
}
int main() {
cout << command("cd ~/.virtualenv/bin && PATH=$(pwd):$PATH && while [ 1 ]; do timeout 45m service; sleep 15m; done") << std::endl;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment