Skip to content

Instantly share code, notes, and snippets.

@DimaDaxDadeco
Created July 19, 2018 07:03
Show Gist options
  • Save DimaDaxDadeco/24be095bfeec1d19047bdb2448fad67c to your computer and use it in GitHub Desktop.
Save DimaDaxDadeco/24be095bfeec1d19047bdb2448fad67c to your computer and use it in GitHub Desktop.
service:
async getJobSchedule({ augurCode, jobType }) {
const readFileAsync = Promise.promisify(fs.readFile);
const filePath = path.resolve(`${__dirname}/../etc/cron.d/${augurCode}_${jobType}.conf`);
const contents = await readFileAsync(filePath, 'utf8');
console.log('blaaa', filePath, contents);
return {};
}
Route Method:
export function* getJobSchedule() {
this.body = yield schedules
.getJobSchedule({
augurCode: this.params.augurCode,
jobType: this.params.jobType,
})
.catch(handleError.bind(this));
}
router.get('/api/schedule/:augurCode/:jobType', authorized(), scheduling.getJobSchedule);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment