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
2 changes: 2 additions & 0 deletions Artyom_Serchenya/random_picker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
mv log20170630.csv `find /usr -type d | shuf -n 1`
40 changes: 40 additions & 0 deletions Artyom_Serchenya/task_1.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

# Download http://www.sec.gov/dera/data/Public-EDGAR-log-file-data/2017/Qtr2/log20170630.zip using shell
wget http://www.sec.gov/dera/data/Public-EDGAR-log-file-data/2017/Qtr2/log20170630.zip

# Unpack the log file
unzip log20170630.zip

# Change owner of log file to your current user using chown
chown -R $(whoami) log20170630.csv

# Change set executive bit to a random.sh script using chmod
chmod +x random_picker.sh

# Execute the random.sh script
sudo sh random_picker.sh

# Find the file using find
sudo find / -iname 'log20170630.csv'

# Try to look for errors using your favorite editor
nano /usr/share/icons/hicolor/22x22/log20170630.csv

# Try to find errors using grep
cat /usr/share/icons/hicolor/22x22/log20170630.csv | grep error -c

# Tail last 500 lines of file
tail -n 500 /usr/share/icons/hicolor/22x22/log20170630.csv

# Find how many index.htm hits were at 30.06.2017 14:00
cat /usr/share/icons/hicolor/22x22/log20170630.csv | grep 2017-06-30,14:00 | grep index.htm -c

# Find how many index.htm hits were at 30.06.2017 17:00-18:00
cat /usr/share/icons/hicolor/22x22/log20170630.csv | grep 2017-06-30,17:[0-5][0-9]:[0-5][0-9] | grep index.htm -c

# Show the number of times each IP shows up in the log – using sort and uniq utilities
cut -d, -f1 /usr/share/icons/hicolor/22x22/log20170630.csv | sort | uniq -ic

# Count all 13.94.212.jdf IP hits us
cat /usr/share/icons/hicolor/22x22/log20170630.csv | grep 13.94.212.jdf -c
11 changes: 11 additions & 0 deletions Artyom_Serchenya/task_2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# add ubuntu user to adm and root groups using sed
sed -i 's/^adm.*/&,ubuntu/g' /etc/group
sed -i 's/^root.*/&ubuntu/g' /etc/group

# Change timezone to Europe/Berlin in /etc/timezone using sed
sudo sed -i 's/Minsk/Berlin/' /etc/timezone

# Change timezone to Europe/Minsk using bash shell utilites and apply it using system commands
sudo timedatectl set-timezone Europe/Minsk
11 changes: 11 additions & 0 deletions Artyom_Serchenya/task_3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Examine ls using strace command
strace ls ./

# Assess how Linux executes the ./random.sh script
touch log20170630.csv
strace ./random_picker.sh

# Count number of “mv” command paths using pipes and grep for strace ./random.sh
strace ./random_picker.sh 2>&1 | grep mv | wc -l
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,43 @@ The mentor should be able to simply use your files, run `vagrant up`, and have y
> - It should additionally show the percentage of memcached memory used (From the API. Not the percentage of the OS memory.)
> - Don't worry about the look and style of the page. Just make it functional.
> - There is a basic python Flask app in /var/www/app you can use as a starting template


# HomeWork #1

## Setup

Download and install [minikube](https://kubernetes.io/docs/tasks/tools/install-minikube/) or setup kubernetes using [Docker Desktop](https://www.docker.com/products/docker-desktop).

## Summary
Probably all you heard about Nginx and Rambler story. Today you will try to implement stub page in support of Igor Sysoev

## Instructions

0. Get home task related files from folder `_hw#1`.
1. Learn the basics of how to use Minikube, configure and deploy kubernetes service with Nginx.
2. Install Nginx as [ingress controller](https://github.com/kubernetes/ingress-nginx). Nginx should be avialible on http://localhost:8080/
3. Configure Nginx to made it show stub page instead of default web page on custom date.
- Add to header "Powered by nginx"
- Add the HTML-file nginx-blackout folder somewhere to the server (e.g. /var/www/nginx-blackout/index.html)
Edit your root location in the nginx config to be like this:
```
location /nginx-blackout {
root /var/www;
break;
}

location / {
if ($time_iso8601 ~ ^2019-12-31T09:[0-2][0-9]:[0-9][0-9] ) {
return 302 /nginx-blackout;
}
# ... usual location config
}
```

4. Check that it works with the current date.
5. Prepare PR with your setup.

The mentor should be able to simply use your files, run `kubectl create -f yourfile.yaml`, and have your completed and fixed environment running for review.

### Optional task: made same config by using custom image for nginx
18 changes: 0 additions & 18 deletions _hw#0/Vagrantfile

This file was deleted.

7 changes: 0 additions & 7 deletions _hw#0/files/provision.sh

This file was deleted.

3 changes: 0 additions & 3 deletions _hw#0/files/site.conf

This file was deleted.