diff --git a/backup/backup_20260405_0110.tar.gz b/backup/backup_20260405_0110.tar.gz new file mode 100644 index 0000000..8cfe7a1 Binary files /dev/null and b/backup/backup_20260405_0110.tar.gz differ diff --git a/backup/backup_20260405_0124.tar.gz b/backup/backup_20260405_0124.tar.gz new file mode 100644 index 0000000..eaff136 Binary files /dev/null and b/backup/backup_20260405_0124.tar.gz differ diff --git a/backup/backup_20260405_0157.tar.gz b/backup/backup_20260405_0157.tar.gz new file mode 100644 index 0000000..8b9910c Binary files /dev/null and b/backup/backup_20260405_0157.tar.gz differ diff --git a/logs/backup.log b/logs/backup.log new file mode 100644 index 0000000..767d3d7 --- /dev/null +++ b/logs/backup.log @@ -0,0 +1,28 @@ +=== Backup === +This directory does not exist +=== Backup === +This directory does not exist +=== Backup === +=== Backup === +Backup file successfully created +Older backup cleaned +=== Backup === +This directory does not exist +=== Backup === +Backup file successfully created +Older backup cleaned +=== Backup === +Backup file successfully created +Older backup cleaned +=== Backup === +Backup file successfully created +Older backup cleaned +=== Backup === +Backup file successfully created +Older backup cleaned +=== Backup === +Backup file successfully created +Older backup cleaned +=== Backup === +Backup file successfully created +Older backup cleaned diff --git a/logs/file_manager.log b/logs/file_manager.log new file mode 100644 index 0000000..03e1fb3 --- /dev/null +++ b/logs/file_manager.log @@ -0,0 +1,9 @@ + file.text successfully created +File successfully renamed to newFile.txt + file2.txt successfully created +file2.txt +logs +newFile.txt +README.md +scripts +file2.txt successfully deleted diff --git a/logs/system_report_01-04-2026.log b/logs/system_report_01-04-2026.log new file mode 100644 index 0000000..8535af2 --- /dev/null +++ b/logs/system_report_01-04-2026.log @@ -0,0 +1,60 @@ +Disk Usage +Filesystem Size Used Avail Use% Mounted on +tmpfs 1.6G 2.3M 1.6G 1% /run +/dev/sda2 480G 43G 413G 10% / +tmpfs 7.7G 60M 7.7G 1% /dev/shm +tmpfs 5.0M 8.0K 5.0M 1% /run/lock +efivarfs 384K 79K 301K 21% /sys/firmware/efi/efivars +/dev/sda1 1.1G 6.2M 1.1G 1% /boot/efi +tmpfs 1.6G 2.6M 1.6G 1% /run/user/1000 +Memory Usage + total used free shared buff/cache available +Mem: 15699 8177 1152 1366 6510 7522 +Swap: 4095 407 3688 +CPU Load + 16:40:27 up 3 days, 2:28, 1 user, load average: 0.94, 0.89, 0.82 +Total running processes +346 +Top 5 memory-consuming processes +Disk Usage +Filesystem Size Used Avail Use% Mounted on +tmpfs 1.6G 2.3M 1.6G 1% /run +/dev/sda2 480G 43G 413G 10% / +tmpfs 7.7G 59M 7.7G 1% /dev/shm +tmpfs 5.0M 8.0K 5.0M 1% /run/lock +efivarfs 384K 79K 301K 21% /sys/firmware/efi/efivars +/dev/sda1 1.1G 6.2M 1.1G 1% /boot/efi +tmpfs 1.6G 2.6M 1.6G 1% /run/user/1000 +Memory Usage + total used free shared buff/cache available +Mem: 15699 8211 1110 1400 6544 7488 +Swap: 4095 407 3688 +CPU Load + 16:42:50 up 3 days, 2:30, 1 user, load average: 0.66, 0.74, 0.77 +Total running processes +349 +Top 5 memory-consuming processes +Disk Usage +Filesystem Size Used Avail Use% Mounted on +tmpfs 1.6G 2.3M 1.6G 1% /run +/dev/sda2 480G 43G 413G 10% / +tmpfs 7.7G 59M 7.7G 1% /dev/shm +tmpfs 5.0M 8.0K 5.0M 1% /run/lock +efivarfs 384K 79K 301K 21% /sys/firmware/efi/efivars +/dev/sda1 1.1G 6.2M 1.1G 1% /boot/efi +tmpfs 1.6G 2.6M 1.6G 1% /run/user/1000 +Memory Usage + total used free shared buff/cache available +Mem: 15699 8116 1209 1343 6488 7583 +Swap: 4095 407 3688 +CPU Load + 16:45:56 up 3 days, 2:33, 1 user, load average: 0.93, 0.73, 0.75 +Total running processes +350 +Top 5 memory-consuming processes +USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND +herolab 6928 5.8 5.2 12906180 843768 ? Sl Mar30 227:52 /snap/firefox/6565/usr/lib/firefox/firefox +herolab 10643 0.8 3.5 3025732 568984 ? Sl Mar30 30:52 /snap/firefox/6565/usr/lib/firefox/firefox -contentproc -isForBrowser -prefsHandle 0:42809 -prefMapHandle 1:271886 -jsInitHandle 2:242012 -parentBuildID 20250718161710 -sandboxReporter 3 -chrootClient 4 -ipcHandle 5 -initialChannelId {cd1da6e4-c04e-4188-a34e-fa8336a331a9} -parentPid 6928 -crashReporter 6 -crashHelperPid 7007 -greomni /snap/firefox/6565/usr/lib/firefox/omni.ja -appomni /snap/firefox/6565/usr/lib/firefox/browser/omni.ja -appDir /snap/firefox/6565/usr/lib/firefox/browser 40 tab +herolab 8084 0.5 3.1 7660672 506592 ? Sl Mar30 21:59 /snap/firefox/6565/usr/lib/firefox/firefox -contentproc -isForBrowser -prefsHandle 0:42458 -prefMapHandle 1:271886 -jsInitHandle 2:242012 -parentBuildID 20250718161710 -sandboxReporter 3 -chrootClient 4 -ipcHandle 5 -initialChannelId {d567320f-e6a3-45e3-b719-55003f28d274} -parentPid 6928 -crashReporter 6 -crashHelperPid 7007 -greomni /snap/firefox/6565/usr/lib/firefox/omni.ja -appomni /snap/firefox/6565/usr/lib/firefox/browser/omni.ja -appDir /snap/firefox/6565/usr/lib/firefox/browser 12 tab +herolab 7742 0.7 2.9 11406048 474664 ? Sl Mar30 30:16 /snap/firefox/6565/usr/lib/firefox/firefox -contentproc -isForBrowser -prefsHandle 0:42458 -prefMapHandle 1:271886 -jsInitHandle 2:242012 -parentBuildID 20250718161710 -sandboxReporter 3 -chrootClient 4 -ipcHandle 5 -initialChannelId {05f6872d-4ffb-4cb0-991b-f41fd573bbcd} -parentPid 6928 -crashReporter 6 -crashHelperPid 7007 -greomni /snap/firefox/6565/usr/lib/firefox/omni.ja -appomni /snap/firefox/6565/usr/lib/firefox/browser/omni.ja -appDir /snap/firefox/6565/usr/lib/firefox/browser 7 tab +herolab 88720 0.3 2.6 1461317556 433008 ? Sl 03:50 2:37 /proc/self/exe --type=utility --utility-sub-type=node.mojom.NodeService --lang=en-US --service-sandbox-type=none --render-node-override=/dev/dri/renderD128 --dns-result-order=ipv4first --experimental-network-inspection --inspect-port=0 --js-flags=--nodecommit_pooled_pages --crashpad-handler-pid=88627 --enable-crash-reporter=116112e8-efe5-4b9f-accd-bebc642d68d8,no_channel --user-data-dir=/home/herolab/.config/Code --standard-schemes=vscode-webview,vscode-file --enable-sandbox --secure-schemes=vscode-webview,vscode-file --cors-schemes=vscode-webview,vscode-file --fetch-schemes=vscode-webview,vscode-file --service-worker-schemes=vscode-webview --code-cache-schemes=vscode-webview,vscode-file --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,13358235925427173423,3662479183552217790,262144 --enable-features=DocumentPolicyIncludeJSCallStacksInCrashReports,EarlyEstablishGpuChannel,EstablishGpuChannelAsync --disable-features=CalculateNativeWinOcclusion,LocalNetworkAccessChecks,ScreenAIOCREnabled,SpareRendererForSitePerProcess,TraceSiteInstanceGetProcessCreation --variations-seed-version --trace-process-track-uuid=3190708991934122588 diff --git a/logs/user_info.log b/logs/user_info.log new file mode 100644 index 0000000..eb45f7e --- /dev/null +++ b/logs/user_info.log @@ -0,0 +1,6 @@ +My name is Steven Ericson and I am from Cameroon. +Age is 30. This is an adult. +My name is Vera Stella and I am from Cameroon. +Age is 10. This is a minor. +My name is Adam Black and I am from USA. +Age is 70. This is a senior. diff --git a/newFile.txt b/newFile.txt new file mode 100644 index 0000000..e69de29 diff --git a/scripts/backup.sh b/scripts/backup.sh new file mode 100755 index 0000000..fe6fe30 --- /dev/null +++ b/scripts/backup.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +backup_folder="backup" +log_folder="logs" +log_file="$log_folder/backup.log" + +# create log and backup folder if it does not exist +cd .. +mkdir -p "$log_folder" +mkdir -p "$backup_folder" + +echo "=== Backup ===" | tee -a "$log_file" + +source_folder=$1 + +# directory validation and creating a compressed backup +if [[ ! -d "$source_folder" ]]; then + echo "This directory does not exist" | tee -a "$log_file" + exit 1 +fi + +timestamp=$(date +"%Y%m%d_%H$M%S") +backup_file="$backup_folder/backup_$timestamp.tar.gz" + +# create compressed backup +tar -cf "$backup_file" "$source_folder" + +echo "Backup file successfully created" | tee -a "$log_file" + +# keep only last 5 backups +ls -t $backup_folder/backup*.tar.gz | tail -n +6 | xargs -r rm + +echo "Older backup cleaned" | tee -a "$log_file" diff --git a/scripts/file_manager.sh b/scripts/file_manager.sh new file mode 100755 index 0000000..feadd58 --- /dev/null +++ b/scripts/file_manager.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +LOG_FOLDER="logs" +LOG_FILE="$LOG_FOLDER/file_manager.log" + +# create folder if it does not exist +cd .. +mkdir -p "$LOG_FOLDER" + +echo "=== File Management ===" | tee -a "$LOG_FOLDER" + +action=$1 +file=$2 + +case "$action" in + "create") + if [[ -f "$file" ]]; then + echo "File already exist!" | tee -a "$LOG_FILE" + else + touch "$file" + echo " $file successfully created" | tee -a "$LOG_FILE" + fi + ;; + "delete") + if [[ -f "$file" ]]; then + rm "$file" + echo "$file successfully deleted" | tee -a "$LOG_FILE" + else + echo "File not found" | tee -a "$LOG_FILE" + fi + ;; + "list") + ls | tee -a "$LOG_FILE" + ;; + "rename") + new_file=$3 + if [[ -f "$file" ]]; then + mv "$file" "$new_file" + echo "File successfully renamed to $new_file" | tee -a "$LOG_FILE" + else + echo "File not found" | tee -a "$LOG_FILE" + fi + ;; + *) + echo "Usage: $0 {create|delete|list|rename} filename filename?" | tee -a "$LOG_FILE" + ;; +esac diff --git a/scripts/system_check.sh b/scripts/system_check.sh new file mode 100755 index 0000000..b53868b --- /dev/null +++ b/scripts/system_check.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +DATE=$(date +"%d-%m-%Y") + +LOG_FOLDER="logs" +LOG_FILE="$LOG_FOLDER/system_report_$DATE.log" + +# creates the folder if it does not exist +cd .. +mkdir -p "$LOG_FOLDER" + +# disk usage +echo "Disk Usage" | tee -a "$LOG_FILE" +df -h | tee -a "$LOG_FILE" + +# memory usage +echo "Memory Usage" | tee -a "$LOG_FILE" +free -m | tee -a "$LOG_FILE" + +# CPU load +echo "CPU Load" | tee -a "$LOG_FILE" +uptime | tee -a "$LOG_FILE" + +# show warning if disk usage exceed 80% +USAGE=$(df -h / | awk 'NR==2 {print $5}' | sed 's/%//') +if [[ "$USAGE" -ge 80 ]]; then + echo "Warning: Disk usage at 80%" | tee -a "$LOG_FILE" +fi + +# count total running processes +echo "Total running processes" | tee -a "$LOG_FILE" +ps aux | wc -l | tee -a "$LOG_FILE" + +# display top 5 memory-consuming processes +echo "Top 5 memory-consuming processes" | tee -a "$LOG_FILE" +ps aux --sort='-%mem' | head -n 6 | tee -a "$LOG_FILE" diff --git a/scripts/user_info.sh b/scripts/user_info.sh new file mode 100755 index 0000000..744899a --- /dev/null +++ b/scripts/user_info.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +LOG_FOLDER="logs" +LOG_FILE="$LOG_FOLDER/user_info.log" + +# ensure the log directory exist +cd .. +mkdir -p "$LOG_FOLDER" + +read -p "Enter name: " name +read -p "Enter age: " age +read -p "Enter country: " country + +echo "My name is $name and I am from $country." | tee -a "$LOG_FILE" + +{ + if [[ $age -gt 0 ]]; then + if [[ $age -lt 18 ]]; then + echo "Age is $age. This is a minor." + elif [[ $age -ge 18 && $age -le 65 ]]; then + echo "Age is $age. This is an adult." + else + echo "Age is $age. This is a senior." + fi + else + echo "Age not valid." + fi +} | tee -a "$LOG_FILE"