Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rt2-main
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
rt2-main
Commits
7307d109
Commit
7307d109
authored
Oct 04, 2020
by
Ahmad Nemati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
2967a739
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
+14
-4
app.js
app.js
+14
-4
No files found.
app.js
View file @
7307d109
...
...
@@ -10,6 +10,9 @@ const shellExec = require('shell-exec')
var
decimalPointRegex
=
/
\-?\d
+
\.\d
+/g
;
let
countReboot
=
5
let
tryFail
=
0
app
.
get
(
'
/
'
,
(
req
,
res
)
=>
{
res
.
send
(
'
Hello World!
'
)
run
()
...
...
@@ -60,8 +63,18 @@ async function run() {
async
function
checkProcessWork
()
{
let
a
=
await
shell
.
exec
(
'
nc -vz 127.0.0.1 443
'
).
stderr
;
if
(
a
.
includes
(
'
succeeded
'
))
if
(
a
.
includes
(
'
succeeded
'
))
{
tryFail
=
0
return
true
}
tryFail
++
if
(
tryFail
>=
countReboot
)
{
reboot
()
return
}
run
()
}
...
...
@@ -71,8 +84,6 @@ cron.schedule('*/10 * * * * *', () => {
});
async
function
calculateSpeed
()
{
...
...
@@ -82,7 +93,6 @@ async function calculateSpeed() {
let
arr
=
d
.
match
(
decimalPointRegex
)
if
(
d
.
includes
(
'
kbit/s
'
))
{
arr
[
0
]
=
1
arr
[
1
]
=
1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment