diff --git a/CKA VM setup.docx b/devopsDoc/CKA VM setup.docx similarity index 100% rename from CKA VM setup.docx rename to devopsDoc/CKA VM setup.docx diff --git a/devopsDoc/Devops.pptx b/devopsDoc/Devops.pptx new file mode 100644 index 0000000..8347fba Binary files /dev/null and b/devopsDoc/Devops.pptx differ diff --git a/Infrastructure as Code.pdf b/devopsDoc/Infrastructure as Code.pdf similarity index 100% rename from Infrastructure as Code.pdf rename to devopsDoc/Infrastructure as Code.pdf diff --git a/Shared Responsibility Model.pdf b/devopsDoc/Shared Responsibility Model.pdf similarity index 100% rename from Shared Responsibility Model.pdf rename to devopsDoc/Shared Responsibility Model.pdf diff --git a/Virtualization.pptx b/devopsDoc/Virtualization.pptx similarity index 100% rename from Virtualization.pptx rename to devopsDoc/Virtualization.pptx diff --git a/doclab/dock1 b/doclab/dock1 new file mode 100644 index 0000000..d136ccf --- /dev/null +++ b/doclab/dock1 @@ -0,0 +1,4 @@ +FROM debian:stable +LABEL authors="sunil" +RUN apt-get update && apt-get install -y --force-yes apache2 +EXPOSE 80 diff --git a/doclab/dockerfileadd b/doclab/dockerfileadd new file mode 100644 index 0000000..072e4b4 --- /dev/null +++ b/doclab/dockerfileadd @@ -0,0 +1,4 @@ +FROM ubuntu:latest +WORKDIR /app +COPY file.txt /app/ +ADD https://github.com/amitopenwriteup/my_proj/blob/master/k8s-setup.txt /app/i diff --git a/doclab/file.txt b/doclab/file.txt new file mode 100644 index 0000000..e69de29 diff --git a/doclab/test/date.sh b/doclab/test/date.sh new file mode 100755 index 0000000..70a516d --- /dev/null +++ b/doclab/test/date.sh @@ -0,0 +1,4 @@ +#!/bin/sh +echo `date` $@ >> log.txt; +cat log.txt; +#save date.sh script diff --git a/doclab/test/log.txt b/doclab/test/log.txt new file mode 100644 index 0000000..0e4cb5d --- /dev/null +++ b/doclab/test/log.txt @@ -0,0 +1,2 @@ +Sun Sep 22 08:33:19 AM UTC 2024 +Sun Sep 22 08:33:23 AM UTC 2024 diff --git a/doclab/test/mydockerfile b/doclab/test/mydockerfile new file mode 100644 index 0000000..be44212 --- /dev/null +++ b/doclab/test/mydockerfile @@ -0,0 +1,3 @@ +FROM alpine +ADD date.sh / +RUN ["/date.sh", "image created"] diff --git a/git_practise/mycode b/git_practise/mycode new file mode 100644 index 0000000..e69de29 diff --git a/git_practise/mycode2 b/git_practise/mycode2 new file mode 100644 index 0000000..e69de29 diff --git a/git_practise/mycode2.txt b/git_practise/mycode2.txt new file mode 100644 index 0000000..d429204 --- /dev/null +++ b/git_practise/mycode2.txt @@ -0,0 +1 @@ +first line of mycode2 diff --git a/script.log b/script.log new file mode 100644 index 0000000..9e3a286 --- /dev/null +++ b/script.log @@ -0,0 +1,2 @@ +Script started at Sun Sep 15 01:29:09 PM UTC 2024 +Script finished at Sun Sep 15 01:29:09 PM UTC 2024 diff --git a/script2.log b/script2.log new file mode 100644 index 0000000..1b243d9 --- /dev/null +++ b/script2.log @@ -0,0 +1,3 @@ +Script started at Sun Sep 15 01:31:39 PM UTC 2024 +Script finished at Sun Sep 15 01:31:39 PM UTC 2024 +sunil is author of this file diff --git a/shellscripting/checkWebsiteStatus.sh b/shellscripting/checkWebsiteStatus.sh new file mode 100755 index 0000000..87b6348 --- /dev/null +++ b/shellscripting/checkWebsiteStatus.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +check_website() { + url="$1" + response=$(curl -s -o /dev/null -w "%{http_code}" "$url") + + if [ "$response" == "200" ]; then + + echo "website $url is up and running" + +else + echo "website $url is down!" + +fi +} +check_website "https://www.google.com" + diff --git a/shellscripting/checkgitrepo.sh b/shellscripting/checkgitrepo.sh new file mode 100755 index 0000000..a27b37e --- /dev/null +++ b/shellscripting/checkgitrepo.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +echo "enter directory" + +read directory + +cd "/"$directory + +echo "current directory is:"; pwd + +output=$(git status) +exp_output ="fatal: not a git repository (or any of the parent directories): .git" + +if ["$output" == "$exp_output"]; +then + echo "directory is not git enabled" + +else + echo "directory is git enabled" + +fi + diff --git a/shellscripting/cpuutil.sh b/shellscripting/cpuutil.sh new file mode 100755 index 0000000..6540dfc --- /dev/null +++ b/shellscripting/cpuutil.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +cpu_usage=$(top -bn1 | grep "Cpu(S)" | awk '{print $2 + $4}') + +if (( $(echo "$cpu_usage > 10" | bc -1) )); then + + echo "Alert: CPU Usage is high ($cpu_usage%)" + +else + +echo "Everything is good : CPU Usage is normal ($cpu_usage%)" +fi diff --git a/shellscripting/findword.sh b/shellscripting/findword.sh new file mode 100755 index 0000000..9d53653 --- /dev/null +++ b/shellscripting/findword.sh @@ -0,0 +1,12 @@ +#!/bin/bash +search_word="Error" +search_file=/var/log/syslog + +if grep -q "$search_word" "$search_file"; +then + echo "found '$search_word' in '$search_file" +else + echo "No '$search_word' found in '$search_file" + +fi + diff --git a/shellscripting/ipfind.sh b/shellscripting/ipfind.sh new file mode 100755 index 0000000..8ea43e4 --- /dev/null +++ b/shellscripting/ipfind.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +ip addr show ens33 | grep "inet" | awk '{print $2}' | cut -d'/' -f1 diff --git a/shellscripting/lab3_shell.sh b/shellscripting/lab3_shell.sh new file mode 100755 index 0000000..70914e4 --- /dev/null +++ b/shellscripting/lab3_shell.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +log_file="script2.log" +# Redirect stdout and stderr to a log file +exec > "$log_file" 2>&1 +echo "Script started at $(date)" +# Your script logic here +echo "Script finished at $(date)" +echo "sunil is author of this file" diff --git a/shellscripting/lab4_shell.txt b/shellscripting/lab4_shell.txt old mode 100644 new mode 100755 diff --git a/shellscripting/lab5_shell.sh b/shellscripting/lab5_shell.sh new file mode 100755 index 0000000..83701bc --- /dev/null +++ b/shellscripting/lab5_shell.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +top -bn1 | grep "Cpu(s)" | awk '{print $2 + $4}'