Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2922628
uptime.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
526 B
Referenced Files
None
Subscribers
None
uptime.js
View Options
#!/usr/bin/env ant
import
{
$
}
from
'ant:shell'
;
import
{
uptime
as
osUptime
,
loadavg
}
from
'ant:os'
;
const
uptime
=
osUptime
();
const
users
=
$
`who | wc -l`
.
text
().
trim
();
const
days
=
Math
.
floor
(
uptime
/
86400
);
const
hours
=
Math
.
floor
((
uptime
%
86400
)
/
3600
);
const
minutes
=
String
(
Math
.
floor
((
uptime
%
3600
)
/
60
)).
padStart
(
2
,
'0'
);
const
load
=
loadavg
()
.
map
(
n
=>
n
.
toFixed
(
2
))
.
join
(
' '
);
console
.
log
(
`up
${
days
}
days,
${
hours
}
:
${
minutes
}
,
${
users
}
user
${
users
==
1
?
''
:
's'
}
, load averages:
${
load
}
`
);
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Fri, Mar 27, 1:21 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
512192
Default Alt Text
uptime.js (526 B)
Attached To
Mode
rANT Ant
Attached
Detach File
Event Timeline
Log In to Comment