Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/auser/processor
The process manager in babysitter
https://github.com/auser/processor
Last synced: 15 days ago
JSON representation
The process manager in babysitter
- Host: GitHub
- URL: https://github.com/auser/processor
- Owner: auser
- Created: 2010-03-05T11:20:13.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2010-03-17T23:51:13.000Z (almost 15 years ago)
- Last Synced: 2024-11-11T12:06:12.489Z (2 months ago)
- Language: C++
- Homepage:
- Size: 184 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
Awesome Lists containing this project
README
Processor
===Processor was written to manage OS processes for [babysitter][0], which is a process manager for the project [Beehive][1]. It's usage is super simple.
The `CombProcess` is a c++ class that allows for callbacks and restarts. For full usage, see test.cpp
void callback(int p) {
printf("callback called!\n");
}
int main (int argc, char const *argv[])
{
CombProcess p; // CombProcess objectp.set_callback(callback); // Set a callback function to be called upon death
p.set_secs(2); // Set the number of seconds between `polling` the pid
p.set_micro(2); // Set the number of microseconds
p.set_nano(2); // Set the number of nanoseconds between pollingconst char* env[] = { "NAME=bob", NULL }; // Setup some environment variables
argv++; // We don't want our program name to be included
p.monitored_start(argc-1, argv, (char **) env); // Run the program
return 0;
}
This test program above will run the function that you specify in argv (as argv[1]). It will call the callback function above since it's specified. If it's not specified, then it will simply restart the program you specify.s test/comb_test1.sh
s test/comb_test2.sh
Author
------Ari Lerner (auser) [email protected]
[0]: http://github.com/auser/babysitter
[1]: http://github.com/auser/beehive