opt. & new

- opt.: docker page perf
- new: docker stats
This commit is contained in:
lollipopkit
2023-08-02 23:07:11 +08:00
parent 336c31e48d
commit 0038ed347f
10 changed files with 215 additions and 136 deletions

View File

@@ -8,7 +8,6 @@ const shellPath = '$serverBoxDir/mobile_app.sh';
const echoPWD = 'echo \$PWD';
enum CmdType {
export,
net,
sys,
cpu,
@@ -23,7 +22,6 @@ enum CmdType {
}
const _cmdList = [
'export LANG=en_US.utf-8',
'cat /proc/net/dev && date +%s',
'cat /etc/os-release | grep PRETTY_NAME',
'cat /proc/stat | grep cpu',
@@ -43,30 +41,32 @@ final shellFuncStatus = AppShellFunc(
's',
);
// Check if `htop` is installed.
// Then app open SSH term and use `htop` or `ps` to see process.
const shellFuncProcess = AppShellFunc(
'process',
'''
if command -v htop &> /dev/null
then
htop
else
top
fi
''',
'p',
const dockerCmds = [
'docker version',
'docker ps -a',
'docker stats --no-stream',
'docker image ls',
];
final shellFuncDocker = AppShellFunc(
// `dockeR` -> avoid conflict with `docker` command
// 以防止循环递归
'dockeR',
dockerCmds.join('\necho $seperator\n'),
'd',
);
final _generated = [
shellFuncStatus,
shellFuncProcess,
shellFuncDocker,
].generate;
final shellCmd = """
# Script for app `${BuildData.name} v1.0.${BuildData.build}`
# Delete this file while app is running will cause app crash
export LANG=en_US.utf-8
$_generated
""";