Compare commits
14 Commits
57e954511d
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| e79941feb9 | |||
| 60f21a56d9 | |||
| cf1f81f1ef | |||
| 886fe1d9ac | |||
| 90c1e28700 | |||
| 532cf15638 | |||
| 648fd1478c | |||
| 6407562103 | |||
| 96b1188222 | |||
| 3ff5d29cde | |||
| fe7b8c6091 | |||
| 68d1d59b16 | |||
| 08eba2eccc | |||
| 777b6b567d |
2
Python_module_1/first_1.py
Normal file
2
Python_module_1/first_1.py
Normal file
@@ -0,0 +1,2 @@
|
||||
#/home/liana/venv/it_school_python/bin/python
|
||||
print("Hello world, from me")
|
||||
@@ -2,11 +2,16 @@
|
||||
This Repo contains simple Bash scripts created during my DevOps learning.
|
||||
|
||||
##Scripts
|
||||
- #!/bin/bash
|
||||
- script.sh - first Bash script
|
||||
- #!/bin/bash
|
||||
- script.sh - first Bash script
|
||||
|
||||
## How to Run:
|
||||
chmod +x script.sh
|
||||
./script.sh
|
||||
|
||||
## Explications:
|
||||
$# -> nr total de argumente
|
||||
$@ -> toate argumentele ca lista
|
||||
for name in "$@" -> itereaza prin fiecare argument
|
||||
exit 0, exit 1 -> cod de succes, eroare
|
||||
|
||||
|
||||
18
check_service.sh
Executable file
18
check_service.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
SERVICE="docker"
|
||||
|
||||
echo "Verific serviciul: $SERVICE"
|
||||
|
||||
if systemctl is-active --quiet $SERVICE; then
|
||||
echo "Serviciul $SERVICE ruleaza"
|
||||
|
||||
else
|
||||
echo "Serviciul $SERVICE NU ruleaza"
|
||||
echo "Pornesc serviciul..."
|
||||
systemctl start $SERVICE
|
||||
echo "Serviciul a fost pornit"
|
||||
fi
|
||||
|
||||
|
||||
19
forFile.sh
Normal file
19
forFile.sh
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Verificăm dacă există cel puțin un argument
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "Usage: ./script.sh <name1> [name2 ... nameN]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Loop prin toate argumentele folosind $@
|
||||
for name in "$@"; do
|
||||
if [ "$name" == "Liana" ]; then
|
||||
echo "Hello, $name! You are awesome!"
|
||||
else
|
||||
echo "Hello, $name!"
|
||||
fi
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
||||
28
script.sh
Normal file → Executable file
28
script.sh
Normal file → Executable file
@@ -1 +1,27 @@
|
||||
fisierul nu exista dar voi incerca sa il afisez
|
||||
#!/bin/bash
|
||||
|
||||
# Verificăm dacă fișierul a fost dat ca argument
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "Usage: ./script.sh <file_with_names>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
file="$1"
|
||||
|
||||
# Verificăm dacă fișierul există
|
||||
if [ ! -f "$file" ]; then
|
||||
echo "File '$file' does not exist!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Loop prin fiecare linie (nume) din fișier
|
||||
while IFS= read -r name; do
|
||||
if [ "$name" == "Liana" ]; then
|
||||
echo "Hello, $name! You are awesome!"
|
||||
else
|
||||
echo "Hello, $name!"
|
||||
fi
|
||||
done < "$file"
|
||||
|
||||
exit 0
|
||||
|
||||
|
||||
2
scriptFinal.sh
Normal file
2
scriptFinal.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
script.sh
|
||||
script.sh
|
||||
Reference in New Issue
Block a user