Commit c24b1790 authored by Ahmad Nemati's avatar Ahmad Nemati

init

parent 3d990ba1
......@@ -2,7 +2,7 @@ let groups = 0
let generation = 0
const express = require('express')
const app = express()
const port = 4000
const port = 3000
const shell = require('shelljs')
const cron = require('node-cron');
const cronRemover = require('node-cron');
......@@ -29,25 +29,7 @@ app.get('/ip/:ip/', (req, res) => {
return addNewIp(req, res)
})
//
// app.get('/add/:num/', (req, res) => {
// // console.log(req.params.acc)
// return newFloatingIpsOrder(req, res)
//
// })
//
// app.get('/del/', (req, res) => {
// // console.log(req.params.acc)
// res.send('Done')
// het.removeAllFloatingIps()
//
// })
//
// app.get('/test', (req, res) => {
// // console.log(req.params.acc)
// res.sendfile('jetmtp.png')
//
// })
......@@ -79,7 +61,7 @@ cron.schedule('*/10 * * * * *', () => {
});
postRequest()
cronRemover.schedule(' */15 * * * *', () => {
cronRemover.schedule(' */2 * * * *', () => {
init()
});
......@@ -247,24 +229,24 @@ async function calculateSpeed() {
let d = await shellExec('vnstat -tr')
d = d.stdout
d = d.match(decimalPointRegex)
let arr = d.match(decimalPointRegex)
if (d.includes('kbit/s')) {
d[0] = 1
d[1] = 1
arr[0] = 1
arr[1] = 1
} else if (d.includes('Mbit/s')) {
} else if (d.includes('Gbit/s')) {
d[0] = d[0] * 1000
d[1] = d[1] * 1000
arr[0] = arr[0] * 1000
arr[1] = arr[1] * 1000
} else if (d.includes('bit/s')) {
d[0] = 1
d[1] = 1
arr[0] = 1
arr[1] = 1
}
await sendRate(d[0], d[1])
await sendRate(arr[0], arr[1])
}
......
......@@ -13,17 +13,7 @@ let serverId
async function test() {
// getNewIp('b.','1','EU-West-1')
// await init()
// console.log(foundDc)
// let d=await unAttachedToServer(1,)
// for(let i=0;i<10;i++)
// {
// let f= await createFloatingIp(1)
// console.log(f)
// }
// let ips = await getAllIps(1)
// console.log(ips)
await deleteAllIps(1)
}
......
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