Compare commits
14 Commits
feature_00
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb5c4e2a84 | ||
|
|
8b9be084fe | ||
| e43b6b8c75 | |||
| bb8d523f47 | |||
|
|
37f0a6276c | ||
| 73f363bc58 | |||
| 1afe97f662 | |||
| 58a7b8d9cb | |||
| 05feb31254 | |||
| 9b7861f0d2 | |||
| fd801c1dff | |||
|
|
4b946e0fa7 | ||
| 215a67fb13 | |||
| 1439a02b4e |
61
Jenkinsfile
vendored
Normal file
61
Jenkinsfile
vendored
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
pipeline {
|
||||||
|
agent any // Use any available Jenkins agent/node
|
||||||
|
|
||||||
|
environment {
|
||||||
|
// ID of the credentials we created in Jenkins for Git
|
||||||
|
GIT_CREDENTIALS = 'gitea-creds'
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
|
||||||
|
stage('Checkout SCM') {
|
||||||
|
steps {
|
||||||
|
// Checkout the repository from Git (the Jenkinsfile's repo)
|
||||||
|
// This gives us the current code in the workspace
|
||||||
|
checkout scm
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Create file') {
|
||||||
|
steps {
|
||||||
|
sh '''
|
||||||
|
# Create a file named jenkis.txt
|
||||||
|
# Content includes a greeting, current date/time, and Jenkins build number
|
||||||
|
echo "Hello from Jenkins! Current time is $(date), run number ${BUILD_NUMBER}" > jenkis.txt
|
||||||
|
|
||||||
|
# Print the content to Jenkins console for visibility
|
||||||
|
cat jenkis.txt
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Commit & Push') {
|
||||||
|
steps {
|
||||||
|
// Provide Git credentials for pushing
|
||||||
|
withCredentials([
|
||||||
|
usernamePassword(
|
||||||
|
credentialsId: env.GIT_CREDENTIALS,
|
||||||
|
usernameVariable: 'GIT_USER',
|
||||||
|
passwordVariable: 'GIT_PASS'
|
||||||
|
)
|
||||||
|
]) {
|
||||||
|
sh '''
|
||||||
|
# Configure Git user for commit
|
||||||
|
git config user.email "jenkins@local"
|
||||||
|
git config user.name "Jenkins"
|
||||||
|
|
||||||
|
# Add the file to staging
|
||||||
|
git add jenkis.txt
|
||||||
|
|
||||||
|
# Commit with a message that includes the build number
|
||||||
|
# If there is nothing new, skip commit
|
||||||
|
git commit -m "Jenkins: update jenkis.txt for run ${BUILD_NUMBER}" || echo "Nothing to commit"
|
||||||
|
|
||||||
|
# Push changes to main branch using credentials
|
||||||
|
git push https://$GIT_USER:$GIT_PASS@gitea.dev.bodnarescu.ro/s_zsolt/test_git.git HEAD:main
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
129
html_report.sh
Executable file
129
html_report.sh
Executable file
@@ -0,0 +1,129 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
REPORT="system_report.html"
|
||||||
|
|
||||||
|
# ---------- HTML HEADER ----------
|
||||||
|
html_header()
|
||||||
|
{
|
||||||
|
cat <<EOF
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>System Report</title>
|
||||||
|
<style>
|
||||||
|
body
|
||||||
|
{
|
||||||
|
font-family: monospace;
|
||||||
|
background: #0f172a;
|
||||||
|
color: #e5e7eb;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
h1
|
||||||
|
{
|
||||||
|
color: #38bdf8;
|
||||||
|
}
|
||||||
|
.section
|
||||||
|
{
|
||||||
|
margin-bottom: 30px;
|
||||||
|
border: 1px solid #334155;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: #020617;
|
||||||
|
}
|
||||||
|
.section h2
|
||||||
|
{
|
||||||
|
margin: 0;
|
||||||
|
padding: 10px;
|
||||||
|
background: #1e293b;
|
||||||
|
color: #fbbf24;
|
||||||
|
border-bottom: 1px solid #334155;
|
||||||
|
}
|
||||||
|
pre
|
||||||
|
{
|
||||||
|
margin: 0;
|
||||||
|
padding: 15px;
|
||||||
|
color: #a7f3d0;
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>System Report</h1>
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
# ---------- HTML FOOTER ----------
|
||||||
|
html_footer()
|
||||||
|
{
|
||||||
|
cat <<EOF
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
# ---------- FUNCTiONS ----------
|
||||||
|
# ---------- RUNNING PORCESSES -----------
|
||||||
|
|
||||||
|
list_processes()
|
||||||
|
{
|
||||||
|
cat <<EOF
|
||||||
|
<div class="section">
|
||||||
|
<h2>Top Processes by CPU</h2>
|
||||||
|
<pre>
|
||||||
|
$(ps aux --sort=-%cpu | head -10)
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
# ---------- DISK USAGE --------------
|
||||||
|
disk_usage()
|
||||||
|
{
|
||||||
|
cat <<EOF
|
||||||
|
<div class="section">
|
||||||
|
<h2>Disk Usage</h2>
|
||||||
|
<pre>
|
||||||
|
$(df -h)
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
# --------- MEMORY USAGE -------------
|
||||||
|
memory_usage()
|
||||||
|
{
|
||||||
|
cat <<EOF
|
||||||
|
<div class="section">
|
||||||
|
<h2>Memory Usage</h2>
|
||||||
|
<pre>
|
||||||
|
$(free -h)
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
# ........... SYSTEM INFO -----------
|
||||||
|
sys_info()
|
||||||
|
{
|
||||||
|
cat <<EOF
|
||||||
|
<div class="section">
|
||||||
|
<h2>System info</h2>
|
||||||
|
<pre>
|
||||||
|
$(lscpu)
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# ---------- BUILD THE ACTUAL REPORT ----------
|
||||||
|
{
|
||||||
|
html_header
|
||||||
|
sys_info
|
||||||
|
list_processes
|
||||||
|
disk_usage
|
||||||
|
memory_usage
|
||||||
|
html_footer
|
||||||
|
} > "$REPORT"
|
||||||
|
|
||||||
|
echo "HTML report generated: $REPORT"
|
||||||
1
jenkis.txt
Normal file
1
jenkis.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Hello from Jenkins! Current time is Tue Feb 10 18:08:38 EET 2026, run number 13
|
||||||
1
jenkis_test.txt
Normal file
1
jenkis_test.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Hello from Jenkins
|
||||||
143
system_report.html
Normal file
143
system_report.html
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>System Report</title>
|
||||||
|
<style>
|
||||||
|
body
|
||||||
|
{
|
||||||
|
font-family: monospace;
|
||||||
|
background: #0f172a;
|
||||||
|
color: #e5e7eb;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
h1
|
||||||
|
{
|
||||||
|
color: #38bdf8;
|
||||||
|
}
|
||||||
|
.section
|
||||||
|
{
|
||||||
|
margin-bottom: 30px;
|
||||||
|
border: 1px solid #334155;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: #020617;
|
||||||
|
}
|
||||||
|
.section h2
|
||||||
|
{
|
||||||
|
margin: 0;
|
||||||
|
padding: 10px;
|
||||||
|
background: #1e293b;
|
||||||
|
color: #fbbf24;
|
||||||
|
border-bottom: 1px solid #334155;
|
||||||
|
}
|
||||||
|
pre
|
||||||
|
{
|
||||||
|
margin: 0;
|
||||||
|
padding: 15px;
|
||||||
|
color: #a7f3d0;
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>System Report</h1>
|
||||||
|
<div class="section">
|
||||||
|
<h2>System info</h2>
|
||||||
|
<pre>
|
||||||
|
Architecture: x86_64
|
||||||
|
CPU op-mode(s): 32-bit, 64-bit
|
||||||
|
Address sizes: 39 bits physical, 48 bits virtual
|
||||||
|
Byte Order: Little Endian
|
||||||
|
CPU(s): 8
|
||||||
|
On-line CPU(s) list: 0-7
|
||||||
|
Vendor ID: GenuineIntel
|
||||||
|
Model name: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
|
||||||
|
CPU family: 6
|
||||||
|
Model: 142
|
||||||
|
Thread(s) per core: 2
|
||||||
|
Core(s) per socket: 4
|
||||||
|
Socket(s): 1
|
||||||
|
Stepping: 10
|
||||||
|
CPU(s) scaling MHz: 43%
|
||||||
|
CPU max MHz: 4000.0000
|
||||||
|
CPU min MHz: 400.0000
|
||||||
|
BogoMIPS: 3999.93
|
||||||
|
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb pti ssbd ibrs ibpb stibp tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust sgx bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp vnmi md_clear flush_l1d arch_capabilities
|
||||||
|
Virtualization: VT-x
|
||||||
|
L1d cache: 128 KiB (4 instances)
|
||||||
|
L1i cache: 128 KiB (4 instances)
|
||||||
|
L2 cache: 1 MiB (4 instances)
|
||||||
|
L3 cache: 8 MiB (1 instance)
|
||||||
|
NUMA node(s): 1
|
||||||
|
NUMA node0 CPU(s): 0-7
|
||||||
|
Vulnerability Gather data sampling: Vulnerable
|
||||||
|
Vulnerability Ghostwrite: Not affected
|
||||||
|
Vulnerability Indirect target selection: Not affected
|
||||||
|
Vulnerability Itlb multihit: KVM: Mitigation: Split huge pages
|
||||||
|
Vulnerability L1tf: Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable
|
||||||
|
Vulnerability Mds: Mitigation; Clear CPU buffers; SMT vulnerable
|
||||||
|
Vulnerability Meltdown: Mitigation; PTI
|
||||||
|
Vulnerability Mmio stale data: Mitigation; Clear CPU buffers; SMT vulnerable
|
||||||
|
Vulnerability Reg file data sampling: Not affected
|
||||||
|
Vulnerability Retbleed: Mitigation; IBRS
|
||||||
|
Vulnerability Spec rstack overflow: Not affected
|
||||||
|
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
|
||||||
|
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
|
||||||
|
Vulnerability Spectre v2: Mitigation; IBRS; IBPB conditional; STIBP conditional; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
|
||||||
|
Vulnerability Srbds: Mitigation; Microcode
|
||||||
|
Vulnerability Tsa: Not affected
|
||||||
|
Vulnerability Tsx async abort: Not affected
|
||||||
|
Vulnerability Vmscape: Mitigation; IBPB before exit to userspace
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
<div class="section">
|
||||||
|
<h2>Top Processes by CPU</h2>
|
||||||
|
<pre>
|
||||||
|
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
|
||||||
|
root 6028 11.6 2.4 1612792 394680 ? Ssl Dec13 10:26 /snap/microk8s/8511/kubelite --scheduler-args-file=/var/snap/microk8s/8511/args/kube-scheduler --controller-manager-args-file=/var/snap/microk8s/8511/args/kube-controller-manager --proxy-args-file=/var/snap/microk8s/8511/args/kube-proxy --kubelet-args-file=/var/snap/microk8s/8511/args/kubelet --apiserver-args-file=/var/snap/microk8s/8511/args/kube-apiserver --kubeconfig-file=/var/snap/microk8s/8511/credentials/client.config --start-control-plane=true
|
||||||
|
dragon 110636 5.3 1.4 2291448 237228 ? Sl 00:06 1:50 /usr/bin/nautilus --gapplication-service
|
||||||
|
dragon 96998 4.5 1.7 1461484404 284200 ? Sl Dec13 1:56 /snap/brave/576/opt/brave.com/brave/brave --type=renderer --crashpad-handler-pid=29847 --enable-crash-reporter=, --enable-distillability-service --origin-trial-public-key=bYUKPJoPnCxeNvu72j4EmPuK7tr1PAC7SHh8ld9Mw3E=,fMS4mpO6buLQ/QMd+zJmxzty/VQ6B1EUZqoCU04zoRU= --change-stack-guard-on-fork=enable --ozone-platform=wayland --lang=en-US --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=15 --time-ticks-at-unix-epoch=-1765660220745216 --launch-time-ticks=2867309737 --shared-files=v8_context_snapshot_data:100 --metrics-shmem-handle=4,i,2887320543730193968,16959484140818579977,2097152 --field-trial-handle=3,i,4607101942233853421,17833277030960201859,262144 --disable-features=EyeDropper --variations-seed-version=main@86482723e393da8d94ccb7893d9d1977c21e0b42 --trace-process-track-uuid=3190709000367499229
|
||||||
|
dragon 2412 4.2 2.1 4931468 350848 ? Ssl Dec13 3:51 /usr/bin/gnome-shell
|
||||||
|
root 1818 3.7 1.7 1528144 277472 ? Ssl Dec13 3:24 /snap/microk8s/8511/bin/k8s-dqlite --storage-dir=/var/snap/microk8s/8511/var/kubernetes/backend/ --listen=unix:///var/snap/microk8s/8511/var/kubernetes/backend/kine.sock:12379
|
||||||
|
root 8803 3.2 0.4 2680796 77004 ? Sl Dec13 2:55 calico-node -felix
|
||||||
|
root 5804 1.9 0.3 3927920 64176 ? Ssl Dec13 1:46 /snap/microk8s/8511/bin/containerd --config /var/snap/microk8s/8511/args/containerd.toml --root /var/snap/microk8s/common/var/lib/containerd --state /var/snap/microk8s/common/run/containerd --address /var/snap/microk8s/common/run/containerd.sock
|
||||||
|
dragon 29845 1.3 2.1 51211500 346788 ? Sl Dec13 1:03 /snap/brave/576/opt/brave.com/brave/brave
|
||||||
|
dragon 29910 1.2 1.4 51182280 229940 ? Sl Dec13 0:58 /snap/brave/576/opt/brave.com/brave/brave --type=gpu-process --ozone-platform=wayland --render-node-override=/dev/dri/renderD128 --crashpad-handler-pid=29847 --enable-crash-reporter=, --change-stack-guard-on-fork=enable --gpu-preferences=UAAAAAAAAAAgAAAEAAAAAAAAAAAAAGAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAgAAAAAAAAA --shared-files --metrics-shmem-handle=4,i,13769344462777288835,16747476483035559645,262144 --field-trial-handle=3,i,4607101942233853421,17833277030960201859,262144 --disable-features=EyeDropper --variations-seed-version=main@86482723e393da8d94ccb7893d9d1977c21e0b42 --trace-process-track-uuid=3190708988185955192
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
<div class="section">
|
||||||
|
<h2>Disk Usage</h2>
|
||||||
|
<pre>
|
||||||
|
Filesystem Size Used Avail Use% Mounted on
|
||||||
|
tmpfs 1.6G 3.3M 1.6G 1% /run
|
||||||
|
/dev/nvme0n1p2 233G 31G 191G 14% /
|
||||||
|
tmpfs 7.7G 44M 7.7G 1% /dev/shm
|
||||||
|
tmpfs 5.0M 8.0K 5.0M 1% /run/lock
|
||||||
|
efivarfs 154K 90K 60K 61% /sys/firmware/efi/efivars
|
||||||
|
/dev/nvme0n1p1 1.1G 6.3M 1.1G 1% /boot/efi
|
||||||
|
tmpfs 1.6G 148K 1.6G 1% /run/user/1000
|
||||||
|
shm 64M 0 64M 0% /var/snap/microk8s/common/run/containerd/io.containerd.grpc.v1.cri/sandboxes/33fee0c98c880a920d18fc14befe4730f06b5e99ea283c005182f6f36078c248/shm
|
||||||
|
shm 64M 0 64M 0% /var/snap/microk8s/common/run/containerd/io.containerd.grpc.v1.cri/sandboxes/745c0aa4a25836805d6d44ece981bb4a2d30e30ae94f9393cdea1ee34da92f83/shm
|
||||||
|
shm 64M 0 64M 0% /var/snap/microk8s/common/run/containerd/io.containerd.grpc.v1.cri/sandboxes/3bbd2cec7fc2f5faaf610ea4bbb1ee86bc7249ae3d66899227df38762c62b479/shm
|
||||||
|
shm 64M 0 64M 0% /var/snap/microk8s/common/run/containerd/io.containerd.grpc.v1.cri/sandboxes/db1ee64672bf99a5c5e603fb5e281d8e0718c97c15f233aece75add147afccb0/shm
|
||||||
|
shm 64M 0 64M 0% /var/snap/microk8s/common/run/containerd/io.containerd.grpc.v1.cri/sandboxes/3f1d6dab9f5bb1bb01ec58ddc23d518dd4e1cc520490b10b1d2db572c72d33d3/shm
|
||||||
|
shm 64M 0 64M 0% /var/snap/microk8s/common/run/containerd/io.containerd.grpc.v1.cri/sandboxes/9a0788625e9d7323baa7ac087c96879af12e6af04f6e5780adfd408a045611f9/shm
|
||||||
|
shm 64M 0 64M 0% /var/snap/microk8s/common/run/containerd/io.containerd.grpc.v1.cri/sandboxes/fcd9afd587d3041ff2aceae0068da70a4ee1c3bc9147b62752d2a6ae6fd30c09/shm
|
||||||
|
shm 64M 0 64M 0% /var/snap/microk8s/common/run/containerd/io.containerd.grpc.v1.cri/sandboxes/8c432fd562bc1db55400f794673a97cdb7a99e1b2956bcfe331e1bc4a0a43ac4/shm
|
||||||
|
shm 64M 0 64M 0% /var/snap/microk8s/common/run/containerd/io.containerd.grpc.v1.cri/sandboxes/e6b37b93cb3a140ed49efd92ab4409c530c27b7a30cda9a8e326743e5a8bb30b/shm
|
||||||
|
shm 64M 0 64M 0% /var/snap/microk8s/common/run/containerd/io.containerd.grpc.v1.cri/sandboxes/6b61ee67ab7ee2d83165d9ca7e1f895588ac58003f84966632cb2fe318bc3169/shm
|
||||||
|
shm 64M 0 64M 0% /var/snap/microk8s/common/run/containerd/io.containerd.grpc.v1.cri/sandboxes/14cf522d0b430e940474546b7796ef91c43606c5c52f5cc821817b9c6c7f45b0/shm
|
||||||
|
shm 64M 0 64M 0% /var/snap/microk8s/common/run/containerd/io.containerd.grpc.v1.cri/sandboxes/069a8a5b6de883920aa8937f8e43c1a0da80e896d19c6ab3f5f60362866b9532/shm
|
||||||
|
shm 64M 0 64M 0% /var/snap/microk8s/common/run/containerd/io.containerd.grpc.v1.cri/sandboxes/70a61a64a7c59acc8f0dc2c46a01f95d5bd609c70ef603e9764514548ab4d0a8/shm
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
<div class="section">
|
||||||
|
<h2>Memory Usage</h2>
|
||||||
|
<pre>
|
||||||
|
total used free shared buff/cache available
|
||||||
|
Mem: 15Gi 3.7Gi 6.7Gi 437Mi 5.7Gi 11Gi
|
||||||
|
Swap: 4.0Gi 0B 4.0Gi
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
179
toolbox.sh
Normal file
179
toolbox.sh
Normal file
@@ -0,0 +1,179 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# ===============================
|
||||||
|
# Colors
|
||||||
|
# ===============================
|
||||||
|
RED="\033[0;31m"
|
||||||
|
GREEN="\033[0;32m"
|
||||||
|
YELLOW="\033[1;33m"
|
||||||
|
CYAN="\033[0;36m"
|
||||||
|
NC="\033[0m"
|
||||||
|
|
||||||
|
LOGFILE="$HOME/toolbox.log"
|
||||||
|
|
||||||
|
# ===============================
|
||||||
|
# Logging function
|
||||||
|
# ===============================
|
||||||
|
log_action() {
|
||||||
|
local msg="$1"
|
||||||
|
echo "$(date '+%Y-%m-%d %H:%M:%S') - $msg" >> "$LOGFILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
# ===============================
|
||||||
|
# Functions / Tools
|
||||||
|
# ===============================
|
||||||
|
sys_info() {
|
||||||
|
echo -e "${CYAN}=== CPU ===${NC}"
|
||||||
|
lscpu | grep "Model name"
|
||||||
|
echo -e "${CYAN}=== Memory ===${NC}"
|
||||||
|
free -h
|
||||||
|
echo -e "${CYAN}=== Disk ===${NC}"
|
||||||
|
df -h
|
||||||
|
read -p "Press Enter to go back..."
|
||||||
|
}
|
||||||
|
|
||||||
|
check_site() {
|
||||||
|
while true; do
|
||||||
|
echo -n -e "${YELLOW}Enter website URL (or 'b' to go back): ${NC}"
|
||||||
|
read name
|
||||||
|
[[ "$name" == "b" ]] && break
|
||||||
|
if curl -s --head "$name" | grep "200 OK" > /dev/null; then
|
||||||
|
echo -e "${GREEN}Site is UP${NC}"
|
||||||
|
log_action "Website check: $name - UP"
|
||||||
|
else
|
||||||
|
echo -e "${RED}Site is DOWN${NC}"
|
||||||
|
log_action "Website check: $name - DOWN"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
list_processes() {
|
||||||
|
echo -e "${CYAN}=== Top Processes by CPU ===${NC}"
|
||||||
|
ps aux --sort=-%cpu | head -10
|
||||||
|
read -p "Press Enter to go back..."
|
||||||
|
}
|
||||||
|
|
||||||
|
disk_usage() {
|
||||||
|
echo -e "${CYAN}=== Disk Usage ===${NC}"
|
||||||
|
df -h
|
||||||
|
read -p "Press Enter to go back..."
|
||||||
|
}
|
||||||
|
|
||||||
|
network_info() {
|
||||||
|
echo -e "${CYAN}=== IP Addresses ===${NC}"
|
||||||
|
ip a
|
||||||
|
echo -e "${CYAN}=== Open Ports (TCP) ===${NC}"
|
||||||
|
sudo netstat -tulnp 2>/dev/null
|
||||||
|
read -p "Press Enter to go back..."
|
||||||
|
}
|
||||||
|
|
||||||
|
ping_test() {
|
||||||
|
echo -n -e "${YELLOW}Enter IP or hostname to ping (b to go back): ${NC}"
|
||||||
|
read target
|
||||||
|
[[ "$target" == "b" ]] && return
|
||||||
|
ping -c 4 "$target"
|
||||||
|
read -p "Press Enter to go back..."
|
||||||
|
}
|
||||||
|
|
||||||
|
list_users() {
|
||||||
|
echo -e "${CYAN}=== System Users ===${NC}"
|
||||||
|
cut -d: -f1 /etc/passwd
|
||||||
|
read -p "Press Enter to go back..."
|
||||||
|
}
|
||||||
|
|
||||||
|
add_user() {
|
||||||
|
echo -n -e "${YELLOW}Enter new username (b to go back): ${NC}"
|
||||||
|
read username
|
||||||
|
[[ "$username" == "b" ]] && return
|
||||||
|
if sudo adduser "$username"; then
|
||||||
|
echo -e "${GREEN}User $username added successfully${NC}"
|
||||||
|
log_action "Added user: $username"
|
||||||
|
else
|
||||||
|
echo -e "${RED}Failed to add user $username${NC}"
|
||||||
|
log_action "Failed to add user: $username"
|
||||||
|
fi
|
||||||
|
read -p "Press Enter to continue..."
|
||||||
|
}
|
||||||
|
|
||||||
|
service_manager() {
|
||||||
|
while true; do
|
||||||
|
clear
|
||||||
|
echo -e "${CYAN}=== Service Manager ===${NC}"
|
||||||
|
echo "1) Start service"
|
||||||
|
echo "2) Stop service"
|
||||||
|
echo "3) Restart service"
|
||||||
|
echo "4) Show running services"
|
||||||
|
echo "5) Back to main menu"
|
||||||
|
read -p "Enter choice [1-5]: " svc_choice
|
||||||
|
|
||||||
|
if ! [[ "$svc_choice" =~ ^[1-5]$ ]]; then
|
||||||
|
echo -e "${RED}Invalid choice${NC}"
|
||||||
|
sleep 1
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
case $svc_choice in
|
||||||
|
1|2|3)
|
||||||
|
read -p "Enter service name: " svc
|
||||||
|
action=$( [ "$svc_choice" == 1 ] && echo start || [ "$svc_choice" == 2 ] && echo stop || echo restart )
|
||||||
|
if sudo systemctl "$action" "$svc"; then
|
||||||
|
echo -e "${GREEN}Service $svc $action successfully${NC}"
|
||||||
|
log_action "Service $svc action $action succeeded"
|
||||||
|
else
|
||||||
|
echo -e "${RED}Service $svc $action failed${NC}"
|
||||||
|
log_action "Service $svc action $action failed"
|
||||||
|
fi
|
||||||
|
read -p "Press Enter to continue..."
|
||||||
|
;;
|
||||||
|
4)
|
||||||
|
echo -e "${CYAN}=== Running Services ===${NC}"
|
||||||
|
systemctl list-units --type=service --state=running | head -20
|
||||||
|
read -p "Press Enter to continue..."
|
||||||
|
;;
|
||||||
|
5)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# ===============================
|
||||||
|
# Main Menu
|
||||||
|
# ===============================
|
||||||
|
while true; do
|
||||||
|
clear
|
||||||
|
echo -e "${CYAN}=== ADMIN TOOLBOX MENU ===${NC}"
|
||||||
|
echo -e "${YELLOW}1) System Info${NC}"
|
||||||
|
echo -e "${YELLOW}2) Check Website Status${NC}"
|
||||||
|
echo -e "${YELLOW}3) List Top Processes${NC}"
|
||||||
|
echo -e "${YELLOW}4) Disk Usage${NC}"
|
||||||
|
echo -e "${YELLOW}5) Network Info${NC}"
|
||||||
|
echo -e "${YELLOW}6) Ping Test${NC}"
|
||||||
|
echo -e "${YELLOW}7) List Users${NC}"
|
||||||
|
echo -e "${YELLOW}8) Add User${NC}"
|
||||||
|
echo -e "${YELLOW}9) Service Manager${NC}"
|
||||||
|
echo -e "${YELLOW}10) Exit${NC}"
|
||||||
|
echo
|
||||||
|
|
||||||
|
read -p "Enter your choice [1-10]: " choice
|
||||||
|
|
||||||
|
# Input validation
|
||||||
|
if ! [[ "$choice" =~ ^[1-9]$|^10$ ]]; then
|
||||||
|
echo -e "${RED}Invalid input! Enter 1-10.${NC}"
|
||||||
|
sleep 1
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
case $choice in
|
||||||
|
1) sys_info ;;
|
||||||
|
2) check_site ;;
|
||||||
|
3) list_processes ;;
|
||||||
|
4) disk_usage ;;
|
||||||
|
5) network_info ;;
|
||||||
|
6) ping_test ;;
|
||||||
|
7) list_users ;;
|
||||||
|
8) add_user ;;
|
||||||
|
9) service_manager ;;
|
||||||
|
10) echo -e "${GREEN}Goodbye!${NC}"; exit 0 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
Reference in New Issue
Block a user