mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 15:24:35 +01:00
opt. & new
- opt.: docker page perf - new: docker stats
This commit is contained in:
@@ -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
|
||||
""";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user