Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
2 changes: 2 additions & 0 deletions devops-bash-toolkit-assessment/backup.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Sat Apr 4 23:28:06 WAT 2026 - Backup created: backups/backup_20260404_232805.tar.gz
Sat Apr 4 23:28:49 WAT 2026 - Backup created: backups/backup_20260404_232849.tar.gz
Binary file not shown.
Binary file not shown.
7 changes: 7 additions & 0 deletions devops-bash-toolkit-assessment/logs/app.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
2026-04-04 23:28:04 - Running all scripts...
2026-04-04 23:28:06 - Completed running all scripts
2026-04-04 23:28:45 - Running system check...
2026-04-04 23:28:45 - system_check.sh completed successfully
2026-04-04 23:28:49 - Running backup...
2026-04-04 23:28:49 - backup.sh completed successfully
2026-04-04 23:28:52 - Exiting run_all.sh
62 changes: 62 additions & 0 deletions devops-bash-toolkit-assessment/logs/system_report_2026-04-04.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
Disk usage
Filesystem Size Used Avail Use% Mounted on
none 1.9G 0 1.9G 0% /usr/lib/modules/6.6.87.2-microsoft-standard-WSL2
none 1.9G 4.0K 1.9G 1% /mnt/wsl
drivers 238G 80G 159G 34% /usr/lib/wsl/drivers
/dev/sdd 1007G 2.3G 954G 1% /
none 1.9G 464K 1.9G 1% /mnt/wslg
none 1.9G 0 1.9G 0% /usr/lib/wsl/lib
rootfs 1.9G 2.7M 1.9G 1% /init
none 1.9G 488K 1.9G 1% /run
none 1.9G 0 1.9G 0% /run/lock
none 1.9G 0 1.9G 0% /run/shm
none 1.9G 76K 1.9G 1% /mnt/wslg/versions.txt
none 1.9G 76K 1.9G 1% /mnt/wslg/doc
C:\ 238G 80G 159G 34% /mnt/c
tmpfs 386M 8.0K 386M 1% /run/user/1000
Memory usage
total used free shared buff/cache available
Mem: 3857 343 3386 3 127 3382
Swap: 1024 0 1024
CPU load (uptime)
23:28:05 up 2 days, 9:45, 1 user, load average: 0.00, 0.05, 0.13
Disk usage is within limit
Total running Processes
34
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 315 0.0 0.5 107172 21248 ? Ssl Apr02 0:00 /usr/bin/python3 /usr/share/unattended-upgrades/unattended-upgrade-shutdown --wait-for-signal
root 4249 0.0 0.5 293040 19968 ? Ssl Apr02 0:04 /usr/libexec/packagekitd
root 256 0.0 0.4 30184 18816 ? Ss Apr02 0:00 /usr/bin/python3 /usr/bin/networkd-dispatcher --run-startup-triggers
root 4464 1.3 0.3 64156 14412 ? S<s Apr02 46:05 /lib/systemd/systemd-journald
systemd+ 4462 0.0 0.3 26204 13884 ? Ss Apr02 0:30 /lib/systemd/systemd-resolved
Disk usage
Filesystem Size Used Avail Use% Mounted on
none 1.9G 0 1.9G 0% /usr/lib/modules/6.6.87.2-microsoft-standard-WSL2
none 1.9G 4.0K 1.9G 1% /mnt/wsl
drivers 238G 80G 159G 34% /usr/lib/wsl/drivers
/dev/sdd 1007G 2.3G 954G 1% /
none 1.9G 464K 1.9G 1% /mnt/wslg
none 1.9G 0 1.9G 0% /usr/lib/wsl/lib
rootfs 1.9G 2.7M 1.9G 1% /init
none 1.9G 488K 1.9G 1% /run
none 1.9G 0 1.9G 0% /run/lock
none 1.9G 0 1.9G 0% /run/shm
none 1.9G 76K 1.9G 1% /mnt/wslg/versions.txt
none 1.9G 76K 1.9G 1% /mnt/wslg/doc
C:\ 238G 80G 159G 34% /mnt/c
tmpfs 386M 8.0K 386M 1% /run/user/1000
Memory usage
total used free shared buff/cache available
Mem: 3857 342 3378 3 136 3378
Swap: 1024 0 1024
CPU load (uptime)
23:28:45 up 2 days, 9:45, 1 user, load average: 0.00, 0.05, 0.13
Disk usage is within limit
Total running Processes
34
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 315 0.0 0.5 107172 21248 ? Ssl Apr02 0:00 /usr/bin/python3 /usr/share/unattended-upgrades/unattended-upgrade-shutdown --wait-for-signal
root 4249 0.0 0.5 293040 19968 ? Ssl Apr02 0:04 /usr/libexec/packagekitd
root 256 0.0 0.4 30184 18816 ? Ss Apr02 0:00 /usr/bin/python3 /usr/bin/networkd-dispatcher --run-startup-triggers
root 4464 1.3 0.3 64156 14412 ? S<s Apr02 46:05 /lib/systemd/systemd-journald
systemd+ 4462 0.0 0.3 26204 13884 ? Ss Apr02 0:30 /lib/systemd/systemd-resolved
6 changes: 6 additions & 0 deletions devops-bash-toolkit-assessment/process_monitor.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Sat Apr 4 23:28:06 WAT 2026 - nginx is Stopped
Sat Apr 4 23:28:06 WAT 2026 - nginx Restart failed (or simulated)
Sat Apr 4 23:28:06 WAT 2026 - ssh is Stopped
Sat Apr 4 23:28:06 WAT 2026 - ssh Restart failed (or simulated)
Sat Apr 4 23:28:06 WAT 2026 - docker is Stopped
Sat Apr 4 23:28:06 WAT 2026 - docker Restart failed (or simulated)
67 changes: 67 additions & 0 deletions devops-bash-toolkit-assessment/run_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/bash
set -euo pipefail
LOG_DIR="logs"
LOG_FILE="$LOG_DIR/app.log"
SCRIPTS_DIR="scripts"
mkdir -p "$LOG_DIR"

# Function to log actions
log_action() {
echo "$(date +"%Y-%m-%d %H:%M:%S") - $1" | tee -a "$LOG_FILE"
}

# Function: Run all scripts
run_all() {
log_action "Running all scripts..."
bash "$SCRIPTS_DIR/system_check.sh" || log_action "system_check.sh failed"
bash "$SCRIPTS_DIR/backup.sh" "$HOME" || log_action "backup.sh failed"
bash "$SCRIPTS_DIR/process_monitor.sh" "nginx" || log_action "process_monitor.sh failed"
log_action "Completed running all scripts"
}
# Function: System check
system_check() {
log_action "Running system check..."
if bash "$SCRIPTS_DIR/system_check.sh"; then
log_action "system_check.sh completed successfully"
else
log_action "system_check.sh failed"
fi
}

# Function: Backup
backup() {
log_action "Running backup..."
if bash "$SCRIPTS_DIR/backup.sh" "$HOME"; then
log_action "backup.sh completed successfully"
else
log_action "backup.sh failed"
fi
}

# Function: Exit
exit_script() {
log_action "Exiting run_all.sh"
exit 0
}

# Interactive menu
while true; do
echo "============================"
echo " Run All Menu"
echo "============================"
echo "1) Run all"
echo "2) System check"
echo "3) Backup"
echo "4) Exit"
echo "============================"
read -rp "Choose an option: " choice

case $choice in
1) run_all ;;
2) system_check ;;
3) backup ;;
4) exit_script ;;
*) echo "Invalid option. Please try again." ;;
esac
done

10 changes: 10 additions & 0 deletions devops-bash-toolkit-assessment/scripts/backup.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Thu Apr 2 11:32:17 WAT 2026 - Backup created: backups/backup_20260402_113217.tar.gz
No directory provided.
Thu Apr 2 11:32:41 WAT 2026 - Backup created: backups/backup_20260402_113241.tar.gz
Thu Apr 2 11:34:02 WAT 2026 - Backup created: backups/backup_20260402_113402.tar.gz
Thu Apr 2 14:50:44 WAT 2026 - Backup created: backups/backup_20260402_145044.tar.gz
Thu Apr 2 14:53:25 WAT 2026 - Backup created: backups/backup_20260402_145325.tar.gz
Thu Apr 2 16:53:20 WAT 2026 - Backup created: backups/backup_20260402_165320.tar.gz
Thu Apr 2 16:53:20 WAT 2026 - Deleted old backup: backups/backup_20260402_113217.tar.gz
Thu Apr 2 16:53:02 WAT 2026 - Backup created: backups/backup_20260402_165302.tar.gz
Thu Apr 2 16:53:02 WAT 2026 - Deleted old backup: backups/backup_20260402_113241.tar.gz
28 changes: 28 additions & 0 deletions devops-bash-toolkit-assessment/scripts/backup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
# Accept a directory as input

SOURCE_DIR=$1
BACKUP_DIR="backups"
LOG_FILE="backup.log"
mkdir -p "$BACKUP_DIR"

# Validate that the directory exists
if [[ -z "$SOURCE_DIR" ]] ; then
echo "No directory provided." | tee -a "$LOG_FILE"
exit 1
elif [[ ! -d "$SOURCE_DIR" ]] ; then
echo "Error: '$SOURCE_DIR' is not a valid directory."
exit 1
fi
# Create and store compressed backup
timestamp=$(date +"%Y%m%d_%H%M%S")
BACKUP_FILE="backups/backup_$timestamp.tar.gz"
tar -czf "$BACKUP_FILE" "$SOURCE_DIR"
echo "$(date) - Backup created: $BACKUP_FILE" | tee -a "$LOG_FILE"

# Keep only the last 5 backups (delete older ones)
ls -t backups/backup_*.tar.gz 2>/dev/null | tail -n +6 |
while read file; do
rm "$file"
echo "$(date) - Deleted old backup: $file" | tee -a "$LOG_FILE"
done
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
46 changes: 46 additions & 0 deletions devops-bash-toolkit-assessment/scripts/file_manager.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

# Support the following commands: create, delete, list, rename.
LOG_DIR="logs"
mkdir -p "$LOG_DIR"
LOG_FILE="$LOG_DIR/file_manager.log"
Filename="file.txt"
Filename1="filenew.txt"
case "$1" in
create)
if [[ -e "$Filename" ]] ; then
echo "File already exist" | tee -a "$LOG_FILE"
else
touch "$Filename"
echo "Created $Filename" | tee -a "$LOG_FILE"
fi
;;
delete)
if [[ -e "$Filename" ]] ; then
rm "$Filename"
echo "Deleted $Filename" | tee -a "$LOG_FILE"
fi
;;
list)
ls
echo "listed files" | tee -a "$LOG_FILE"
;;
rename)
Filename="file.txt"
Filename1="filenew.txt"
touch "$Filename" | tee -a "$LOG_FILE"
if [[ ! -e $Filename ]] ; then
echo "file does not exist"
elif [[ -e $Filename1 ]] ; then
echo "File already exists. Cannot overwrite." | tee -a "$LOG_FILE"
else
mv "$Filename" "$Filename1"
echo "Renamed $Filename to $Filename1" | tee -a "$LOG_FILE"
fi
;;
*)
echo "Usage: $0 {create|delete|list|rename} [filename] [newname]"
;;
esac


Empty file.
4 changes: 4 additions & 0 deletions devops-bash-toolkit-assessment/scripts/logs/file_manager.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Created file.txt
Deleted file.txt
listed files
Renamed file.txt to filenew.txt
36 changes: 36 additions & 0 deletions devops-bash-toolkit-assessment/scripts/logs/system_report_
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Disk usage
Memory usage
CPU load (uptime)
Disk usage is within limit
Total running Processes
Disk usage
Filesystem Size Used Avail Use% Mounted on
none 1.9G 0 1.9G 0% /usr/lib/modules/6.6.87.2-microsoft-standard-WSL2
none 1.9G 4.0K 1.9G 1% /mnt/wsl
drivers 238G 73G 166G 31% /usr/lib/wsl/drivers
/dev/sdd 1007G 2.3G 954G 1% /
none 1.9G 140K 1.9G 1% /mnt/wslg
none 1.9G 0 1.9G 0% /usr/lib/wsl/lib
rootfs 1.9G 2.7M 1.9G 1% /init
none 1.9G 492K 1.9G 1% /run
none 1.9G 0 1.9G 0% /run/lock
none 1.9G 0 1.9G 0% /run/shm
none 1.9G 76K 1.9G 1% /mnt/wslg/versions.txt
none 1.9G 76K 1.9G 1% /mnt/wslg/doc
C:\ 238G 73G 166G 31% /mnt/c
tmpfs 386M 8.0K 386M 1% /run/user/1000
Memory usage
total used free shared buff/cache available
Mem: 3857 312 3324 3 220 3403
Swap: 1024 0 1024
CPU load (uptime)
14:49:40 up 13:01, 1 user, load average: 0.06, 0.03, 0.05
Disk usage is within limit
Total running Processes
35
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 315 0.0 0.5 107172 21248 ? Ssl 01:48 0:00 /usr/bin/python3 /usr/share/unattended-upgrades/unattended-upgrade-shutdown --wait-for-signal
root 4249 0.0 0.5 293040 19968 ? Ssl 04:31 0:01 /usr/libexec/packagekitd
root 256 0.0 0.4 30184 18816 ? Ss 01:48 0:00 /usr/bin/python3 /usr/bin/networkd-dispatcher --run-startup-triggers
root 4464 1.3 0.3 64080 14420 ? S<s 04:32 8:32 /lib/systemd/systemd-journald
systemd+ 4462 0.0 0.3 26204 13884 ? Ss 04:32 0:05 /lib/systemd/systemd-resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Disk usage
Filesystem Size Used Avail Use% Mounted on
none 1.9G 0 1.9G 0% /usr/lib/modules/6.6.87.2-microsoft-standard-WSL2
none 1.9G 4.0K 1.9G 1% /mnt/wsl
drivers 238G 73G 165G 31% /usr/lib/wsl/drivers
/dev/sdd 1007G 2.3G 954G 1% /
none 1.9G 160K 1.9G 1% /mnt/wslg
none 1.9G 0 1.9G 0% /usr/lib/wsl/lib
rootfs 1.9G 2.7M 1.9G 1% /init
none 1.9G 488K 1.9G 1% /run
none 1.9G 0 1.9G 0% /run/lock
none 1.9G 0 1.9G 0% /run/shm
none 1.9G 76K 1.9G 1% /mnt/wslg/versions.txt
none 1.9G 76K 1.9G 1% /mnt/wslg/doc
C:\ 238G 73G 165G 31% /mnt/c
tmpfs 386M 8.0K 386M 1% /run/user/1000
Memory usage
total used free shared buff/cache available
Mem: 3857 321 3031 3 504 3390
Swap: 1024 0 1024
CPU load (uptime)
18:16:55 up 15:27, 1 user, load average: 0.09, 0.08, 0.11
Disk usage is within limit
Total running Processes
32
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 315 0.0 0.5 107172 21248 ? Ssl 02:48 0:00 /usr/bin/python3 /usr/share/unattended-upgrades/unattended-upgrade-shutdown --wait-for-signal
root 4249 0.0 0.5 293040 19968 ? Ssl 05:31 0:01 /usr/libexec/packagekitd
root 256 0.0 0.4 30184 18816 ? Ss 02:48 0:00 /usr/bin/python3 /usr/bin/networkd-dispatcher --run-startup-triggers
root 4464 1.3 0.3 64080 14424 ? D<s 05:32 10:22 /lib/systemd/systemd-journald
systemd+ 4462 0.0 0.3 26204 13884 ? Ss 05:32 0:07 /lib/systemd/systemd-resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Disk usage
Filesystem Size Used Avail Use% Mounted on
none 1.9G 0 1.9G 0% /usr/lib/modules/6.6.87.2-microsoft-standard-WSL2
none 1.9G 4.0K 1.9G 1% /mnt/wsl
drivers 238G 73G 166G 31% /usr/lib/wsl/drivers
/dev/sdd 1007G 2.3G 954G 1% /
none 1.9G 140K 1.9G 1% /mnt/wslg
none 1.9G 0 1.9G 0% /usr/lib/wsl/lib
rootfs 1.9G 2.7M 1.9G 1% /init
none 1.9G 488K 1.9G 1% /run
none 1.9G 0 1.9G 0% /run/lock
none 1.9G 0 1.9G 0% /run/shm
none 1.9G 76K 1.9G 1% /mnt/wslg/versions.txt
none 1.9G 76K 1.9G 1% /mnt/wslg/doc
C:\ 238G 73G 166G 31% /mnt/c
tmpfs 386M 8.0K 386M 1% /run/user/1000
Memory usage
total used free shared buff/cache available
Mem: 3857 328 3012 3 515 3383
Swap: 1024 0 1024
CPU load (uptime)
15:02:08 up 13:13, 1 user, load average: 0.10, 0.06, 0.02
Disk usage is within limit
Total running Processes
32
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 315 0.0 0.5 107172 21248 ? Ssl 01:48 0:00 /usr/bin/python3 /usr/share/unattended-upgrades/unattended-upgrade-shutdown --wait-for-signal
root 4249 0.0 0.5 293040 19968 ? Ssl 04:31 0:01 /usr/libexec/packagekitd
root 256 0.0 0.4 30184 18816 ? Ss 01:48 0:00 /usr/bin/python3 /usr/bin/networkd-dispatcher --run-startup-triggers
root 4464 1.3 0.3 64080 14396 ? S<s 04:32 8:47 /lib/systemd/systemd-journald
systemd+ 4462 0.0 0.3 26204 13884 ? Ss 04:32 0:06 /lib/systemd/systemd-resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Disk usage
Filesystem Size Used Avail Use% Mounted on
none 1.9G 0 1.9G 0% /usr/lib/modules/6.6.87.2-microsoft-standard-WSL2
none 1.9G 4.0K 1.9G 1% /mnt/wsl
drivers 238G 73G 166G 31% /usr/lib/wsl/drivers
/dev/sdd 1007G 2.3G 954G 1% /
none 1.9G 152K 1.9G 1% /mnt/wslg
none 1.9G 0 1.9G 0% /usr/lib/wsl/lib
rootfs 1.9G 2.7M 1.9G 1% /init
none 1.9G 488K 1.9G 1% /run
none 1.9G 0 1.9G 0% /run/lock
none 1.9G 0 1.9G 0% /run/shm
none 1.9G 76K 1.9G 1% /mnt/wslg/versions.txt
none 1.9G 76K 1.9G 1% /mnt/wslg/doc
C:\ 238G 73G 166G 31% /mnt/c
tmpfs 386M 8.0K 386M 1% /run/user/1000
Memory usage
total used free shared buff/cache available
Mem: 3857 336 3005 3 515 3375
Swap: 1024 0 1024
CPU load (uptime)
16:35:05 up 13:49, 1 user, load average: 0.05, 0.04, 0.00
Disk usage is within limit
Total running Processes
33
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 315 0.0 0.5 107172 21248 ? Ssl 02:45 0:00 /usr/bin/python3 /usr/share/unattended-upgrades/unattended-upgrade-shutdown --wait-for-signal
root 4249 0.0 0.5 293040 19968 ? Ssl 05:28 0:01 /usr/libexec/packagekitd
root 256 0.0 0.4 30184 18816 ? Ss 02:45 0:00 /usr/bin/python3 /usr/bin/networkd-dispatcher --run-startup-triggers
root 4464 1.3 0.3 64080 14412 ? S<s 05:28 9:10 /lib/systemd/systemd-journald
systemd+ 4462 0.0 0.3 26204 13884 ? Ss 05:28 0:06 /lib/systemd/systemd-resolved
24 changes: 24 additions & 0 deletions devops-bash-toolkit-assessment/scripts/logs/user_info.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Age must be numeric
Welcome on board, Hilda from Nigeria, aged ten. Nice to meet you!
Minor (<18)
Valid input
Age must be numeric
Welcome on board, hil from ni, aged ten. Nice to meet you!
Valid input
Age must be numeric
Welcome on board, Hil from ni, aged ten. Nice to meet you!
Minor (<18)
Valid input
Valid 65
Welcome on board, hil from ni, aged 65. Nice to meet you!
Adult (18–65)
Valid input
All fields are required.
Age must be numeric
Welcome on board, hil from ni, aged ten. Nice to meet you!
Minor (<18)
Age must be numeric
Welcome on board, Hil from Ni, aged 66. Nice to meet you!
Senior (65+)
Welcome on board, Ify from Ghana, aged 20. Nice to meet you!
Adult (18–65)
Loading