mirror of
https://github.com/ohwgiles/laminar.git
synced 2026-03-02 03:40:21 +00:00
allow setting a job description
adding DESCRIPTION=foo to $JOBNAME.conf will display "foo" in the job overview page on the frontend Resolves #97
This commit is contained in:
@@ -51,11 +51,16 @@ public:
|
||||
return kj::heap<EventSource>(*ioContext, bind_http.c_str(), path);
|
||||
}
|
||||
|
||||
void defineJob(const char* name, const char* scriptContent) {
|
||||
void defineJob(const char* name, const char* scriptContent, const char* configContent = nullptr) {
|
||||
KJ_IF_MAYBE(f, tmp.fs->tryOpenFile(kj::Path{"cfg", "jobs", std::string(name) + ".run"},
|
||||
kj::WriteMode::CREATE | kj::WriteMode::CREATE_PARENT | kj::WriteMode::EXECUTABLE)) {
|
||||
(*f)->writeAll(std::string("#!/bin/sh\n") + scriptContent + "\n");
|
||||
}
|
||||
if(configContent) {
|
||||
KJ_IF_MAYBE(f, tmp.fs->tryOpenFile(kj::Path{"cfg", "jobs", std::string(name) + ".conf"}, kj::WriteMode::CREATE)) {
|
||||
(*f)->writeAll(configContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct RunExec {
|
||||
|
||||
Reference in New Issue
Block a user