update
This commit is contained in:
74
index.js
74
index.js
@@ -43,21 +43,85 @@ cron.schedule(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
cron.schedule("* * * * *", async () => {
|
cron.schedule(
|
||||||
|
"5-59 14 * * *",
|
||||||
|
async () => {
|
||||||
exec("sh /home/script/script.sh", (error, stdout, stderr) => {
|
exec("sh /home/script/script.sh", (error, stdout, stderr) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error(`Gagal menjalankan script: ${error.message}`);
|
console.error(
|
||||||
|
`Gagal menjalankan script Antrisimatupang : ${error.message}`
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stderr) {
|
if (stderr) {
|
||||||
console.error(`Stderr: ${stderr}`);
|
console.error(`Stderr Antrisimatupang : ${stderr}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`Output: ${stdout}`);
|
console.log(`Output Antrisimatupang: ${stdout}`);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
exec("sh /home/script/script2.sh", (error, stdout, stderr) => {
|
||||||
|
if (error) {
|
||||||
|
console.error(
|
||||||
|
`Gagal menjalankan script antributikemas : ${error.message}`
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stderr) {
|
||||||
|
console.error(`Stderr antributikemas : ${stderr}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`Output antributikemas: ${stdout}`);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
{
|
||||||
|
timezone: "Asia/Jakarta",
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
cron.schedule(
|
||||||
|
"0-5 15 * * *",
|
||||||
|
async () => {
|
||||||
|
exec("sh /home/script/script.sh", (error, stdout, stderr) => {
|
||||||
|
if (error) {
|
||||||
|
console.error(
|
||||||
|
`Gagal menjalankan script antrisimatupang: ${error.message}`
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stderr) {
|
||||||
|
console.error(`Stderr antrisimatupang: ${stderr}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`Output antrisimatupang : ${stdout}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
exec("sh /home/script/script2.sh", (error, stdout, stderr) => {
|
||||||
|
if (error) {
|
||||||
|
console.error(
|
||||||
|
`Gagal menjalankan script antributikemas: ${error.message}`
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stderr) {
|
||||||
|
console.error(`Stderr antributikemas : ${stderr}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`Output antributikemas : ${stdout}`);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
{
|
||||||
|
timezone: "Asia/Jakarta",
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
app.use((req, res) => {
|
app.use((req, res) => {
|
||||||
res.json("What are you looking for?!");
|
res.json("What are you looking for?!");
|
||||||
|
|||||||
Reference in New Issue
Block a user