/l3/users/slm/2018-12-minsk-aws/student03.BigClassRoom/user :1 :2 :3 :4 :5 :6 :7 |
|
$sudo cp aws/config/qrencode.conf /etc/nginx/sites-available/default
sudo apt-get update -y sudo apt-get install -y nginx git-core qrencode python-virtualenv sudo cp config/qrencode.conf /etc/nginx/sites-available/default git clone https://github.com/chubin/qrenco.de cd qrenco.de ve/bin/pip install -r requirements.txt # sudo cp config/qrencode.conf /etc/nginx/sites-available/default # # git clone https://github.com/chubin/qrenco.de #cd qrenco.de ... #nohup ve/bin/python bin/srv.py >> log/qrencode.log 2>&1 & #udo /etc/init.d/nginx restart # sudo /etc/init.d/nginx restart git clone https://github.com/sl-2018-12/aws sudo cp aws/config/qrencode.conf /etc/nginx/sites-available/default ~ ~ ~ ~ "scripts/install-qrencode.sh" 18L, 570C written |
$ssh m0
user@m0's password: Linux instructor 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Thu Dec 20 14:49:01 2018 from 172.20.13.187 l3-agent is already running: pid=1843; pidfile=/home/user/.lilalo/l3-agent.pid user@instructor:~$ more aws/scripts/ ... sudo cp aws/config/qrencode.conf /etc/nginx/sites-available/default git clone https://github.com/chubin/qrenco.de cd qrenco.de virtualenv ve/ ve/bin/pip install -r requirements.txt mkdir -p log/ nohup ve/bin/python bin/srv.py >> log/qrencode.log 2>&1 & sudo /etc/init.d/nginx restart user@instructor:~$ logout Connection to m0 closed. |
$vi scripts/install-qrencode.sh
|
$git commit - m 'with config on git'
error: pathspec '-' did not match any file(s) known to git. error: pathspec 'm' did not match any file(s) known to git. error: pathspec 'with config on git' did not match any file(s) known to git. |
$more scripts/install-qrencode.sh
|
$git diff
|
$git push
Username for 'https://github.com': ValeryBarai Password for 'https://ValeryBarai@github.com': Everything up-to-date |
$git diff
|
$git status
On branch master Your branch is up-to-date with 'origin/master'. Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: scripts/install-qrencode.sh |
$git commit
on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly: git config --global user.name "Your Name" git config --global user.email you@example.com After doing this, you may fix the identity used for this commit with: git commit --amend --reset-author 1 file changed, 14 insertions(+), 2 deletions(-) |
$git commit -m
error: switch `m' requires a value usage: git commit [<options>] [--] <pathspec>... -q, --quiet suppress summary after successful commit -v, --verbose show diff in commit message template Commit message options -F, --file <file> read message from file --author <author> override author for commit --date <date> override date for commit -m, --message <message> commit message ... --dry-run show what would be committed --short show status concisely --branch show branch information --porcelain machine-readable output --long show status in long format (default) -z, --null terminate entries with NUL --amend amend previous commit --no-post-rewrite bypass post-rewrite hook -u, --untracked-files[=<mode>] show untracked files, optional modes: all, normal, no. (Default: all) |
$git commit -m '1'
On branch master Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits) nothing to commit, working tree clean |
$git push
Username for 'https://github.com': ValeryBarai Password for 'https://ValeryBarai@github.com': Counting objects: 4, done. Delta compression using up to 4 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 605 bytes | 0 bytes/s, done. Total 4 (delta 1), reused 0 (delta 0) remote: Resolving deltas: 100% (1/1), completed with 1 local object. To https://github.com/ValeryBarai/AWS.git f9155c4..856c03a master -> master |
$vi scripts/create-infrastructure.sh
|
$ssh m0
user@m0's password: Linux instructor 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Thu Dec 20 14:53:25 2018 from 172.20.13.189 l3-agent is already running: pid=1843; pidfile=/home/user/.lilalo/l3-agent.pid user@instructor:~$ more aws/scripts/ ... --query 'Reservations[*].Instances[?KeyName==`'$KEY_NAME'`].InstanceId' \ --output text user@instructor:~$ ! user@instructor:~$ scp aws/scripts/in aws/scripts/initial-command.sh aws/scripts/install-qrencode.sh user@instructor:~$ scp aws/scripts/initial-command.sh m3:~/AWS/scripts/ user@m3's password: initial-command.sh 100% 110 219.8KB/s 00:00 user@instructor:~$ logout Connection to m0 closed. |
$vi
|
$vi create-infrastructure.sh
|
$ls -la
total 24 drwxr-xr-x 2 user user 4096 Dec 20 15:20 . drwxr-xr-x 4 user user 4096 Dec 20 14:30 .. -rwxr-xr-x 1 user user 1730 Dec 20 15:20 create-infrastructure.sh -rwxr-xr-x 1 user user 1480 Dec 19 17:05 create-infrastructure.sh.save -rw-r--r-- 1 user user 110 Dec 20 15:20 initial-command.sh -rw-r--r-- 1 user user 721 Dec 20 14:53 install-qrencode.sh |
$rm create-infrastructure.sh.save
|
$ls -la
total 20 drwxr-xr-x 2 user user 4096 Dec 20 15:21 . drwxr-xr-x 4 user user 4096 Dec 20 14:30 .. -rwxr-xr-x 1 user user 1730 Dec 20 15:20 create-infrastructure.sh -rw-r--r-- 1 user user 110 Dec 20 15:20 initial-command.sh -rw-r--r-- 1 user user 721 Dec 20 14:53 install-qrencode.sh |
$more initial-command.sh
|
$more /home/user/AWS/scripts/initial-command.sh
|
$sc
scanimage scrollkeeper-get-cl scanin scrollkeeper-get-content-list scour scrollkeeper-get-extended-content-list scp scrollkeeper-get-index-from-docpath scp-dbus-service scrollkeeper-get-toc-from-docpath screen scrollkeeper-get-toc-from-id screendump scrollkeeper-install script scrollkeeper-preinstall scriptreplay scrollkeeper-rebuilddb scrollkeeper-config scrollkeeper-uninstall scrollkeeper-extract scrollkeeper-update scrollkeeper-gen-seriesid |
$scr
screen scrollkeeper-get-extended-content-list screendump scrollkeeper-get-index-from-docpath script scrollkeeper-get-toc-from-docpath scriptreplay scrollkeeper-get-toc-from-id scrollkeeper-config scrollkeeper-install scrollkeeper-extract scrollkeeper-preinstall scrollkeeper-gen-seriesid scrollkeeper-rebuilddb scrollkeeper-get-cl scrollkeeper-uninstall scrollkeeper-get-content-list scrollkeeper-update |
$./scripts/create-infrastructure.sh
Usage: ./scripts/create-infrastructure.sh start|stop |
$./scripts/create-infrastructure.sh start
./scripts/create-infrastructure.sh: line 18: local: `user_datafile:///home/user/AWS/scripts/initial-command.sh': not a valid identifier ^C |
$ls -la scripts/
create-infrastructure.sh initial-command.sh install-qrencode.sh |
$scripts/create-infrastructure.sh start
scripts/create-infrastructure.sh: line 18: local: `user_datafile:///home/user/AWS/scripts/initial-command.sh': not a valid identifier An error occurred (InvalidIPAddress.InUse) when calling the RunInstances operation: Address 10.1.1.31 is in use. |
$scripts/create-infrastructure.sh stop
{ "TerminatingInstances": [ { "InstanceId": "i-047831225d25b0e34", "CurrentState": { "Code": 32, "Name": "shutting-down" }, "PreviousState": { "Code": 16, "Name": "running" } } ] } |
$scripts/create-infrastructure.sh stop
{ "TerminatingInstances": [ { "InstanceId": "i-047831225d25b0e34", "CurrentState": { "Code": 48, "Name": "terminated" }, "PreviousState": { "Code": 48, "Name": "terminated" } } ] } |
$ssh m0
user@m0's password: Linux instructor 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Thu Dec 20 15:15:00 2018 from 172.20.13.189 l3-agent is already running: pid=1843; pidfile=/home/user/.lilalo/l3-agent.pid 3:~/AWS/ user@m3's password: create-infrastructure.sh 100% 2040 3.0MB/s 00:00 user@instructor:~$ logout Connection to m0 closed. |
$cd AWS/
|
$ls -la | grep create-infrastructure.sh
-rwxr-xr-x 1 user user 2040 Dec 20 15:34 create-infrastructure.sh |
$more create-infrastructure.sh
|
$cat create-infrastructure.sh
#!/bin/bash USER_NAME=user10 IMAGE_ID=ami-02fc24d56bc5f3d67 # ami-09693313102a30b2c INSTANCE_TYPE=t2.micro VPC_ID=vpc-04540e242cdfb35de KEY_NAME=user10 SUBNET_ID=subnet-0d00d8b5d01e66e35 SHUTDOWN_TYPE=stop TAGS="ResourceType=instance,Tags=[{Key=installation_id,Value=${USER_NAME}-1},{Key=Name,Value=NAME}]" initial_command() ... start elif [ "$1" = stop ]; then stop else cat <<EOF Usage: $0 start|stop EOF exit 1 fi |
$vi scripts/create-infrastructure.sh
|
$vi scripts/create-infrastructure.sh
|
$vi scripts/create-infrastructure.sh
|
$vim scripts/create-infrastructure.sh
|
$vim scripts/create-infrastructure.sh
|
$cd ls -la
bash: cd: too many arguments |
$cd scripts/
|
$ls -la
total 36 drwxr-xr-x 2 user user 4096 Dec 20 15:36 . drwxr-xr-x 4 user user 4096 Dec 20 15:34 .. -rwxr-xr-x 1 user user 1768 Dec 20 15:35 create-infrastructure.sh -rw-r--r-- 1 user user 12288 Dec 20 15:36 .create-infrastructure.sh.swo -rw-r--r-- 1 user user 4096 Dec 20 15:35 .create-infrastructure.sh.swp -rw-r--r-- 1 user user 110 Dec 20 15:20 initial-command.sh -rw-r--r-- 1 user user 721 Dec 20 14:53 install-qrencode.sh |
$rm .create-infrastructure.sh.swo
|
$rm .create-infrastructure.sh.swp
|
$more create-infrastructure.sh
|
$vi
|
$vi scripts/create-infrastructure.sh
|
$sc
scanimage scriptreplay scrollkeeper-get-toc-from-docpath scanin scrollkeeper-config scrollkeeper-get-toc-from-id scour scrollkeeper-extract scrollkeeper-install scp scrollkeeper-gen-seriesid scrollkeeper-preinstall scp-dbus-service scrollkeeper-get-cl scrollkeeper-rebuilddb screen scrollkeeper-get-content-list scrollkeeper-uninstall screendump scrollkeeper-get-extended-content-list scrollkeeper-update script scrollkeeper-get-index-from-docpath |
$./scripts/create-infrastructure.sh start
./scripts/create-infrastructure.sh: line 18: local: `user_datafile:///home/user/AWS/scripts/initial-command.sh': not a valid identifier { "Instances": [ { "Monitoring": { "State": "disabled" }, "PublicDnsName": "", "StateReason": { "Message": "pending", ... "Key": "installation_id" } ], "AmiLaunchIndex": 0 } ], "ReservationId": "r-01cd179daf7ae4562", "Groups": [], "OwnerId": "886677986286" } |
$cd scripts/
|
$ls -la
total 20 drwxr-xr-x 2 user user 4096 Dec 20 15:40 . drwxr-xr-x 4 user user 4096 Dec 20 15:34 .. -rwxr-xr-x 1 user user 1806 Dec 20 15:40 create-infrastructure.sh -rw-r--r-- 1 user user 110 Dec 20 15:20 initial-command.sh -rw-r--r-- 1 user user 721 Dec 20 14:53 install-qrencode.sh |
$chmod +x initial-command.sh
|
$chmod +x install-qrencode.sh
|
$cd ..
|
$vi scripts/create-infrastructure.sh
|
$git status
On branch master Your branch is up-to-date with 'origin/master'. Changes not staged for commit: (use "git add/rm <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: scripts/create-infrastructure.sh deleted: scripts/create-infrastructure.sh.save modified: scripts/install-qrencode.sh Untracked files: (use "git add <file>..." to include in what will be committed) create-infrastructure.sh scripts/initial-command.sh no changes added to commit (use "git add" and/or "git commit -a") |
$git add -p
diff --git a/scripts/create-infrastructure.sh b/scripts/create-infrastructure.sh index 94d313c..e6f1737 100755 --- a/scripts/create-infrastructure.sh +++ b/scripts/create-infrastructure.sh @@ -15,6 +15,7 @@ start_vm() local private_ip_address="$1" local public_ip_address="$2" local name="$3" + local user_data="$4" local tags=$(echo $TAGS | sed s/NAME/$name/) ... -Usage: - - $0 start|stop -EOF -fi Stage deletion [y,n,q,a,d,/,?]? y diff --git a/scripts/install-qrencode.sh b/scripts/install-qrencode.sh old mode 100644 new mode 100755 Stage mode change [y,n,q,a,d,/,?]? y |
$git add -p scripts/
No changes. |
$git status
On branch master Your branch is up-to-date with 'origin/master'. Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: scripts/create-infrastructure.sh deleted: scripts/create-infrastructure.sh.save modified: scripts/install-qrencode.sh Untracked files: (use "git add <file>..." to include in what will be committed) create-infrastructure.sh scripts/initial-command.sh |
$git commit -m 'with user-data'
[master a390751] with user-data Committer: ValeryBarai <user@m3.class.sl> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly: git config --global user.name "Your Name" git config --global user.email you@example.com After doing this, you may fix the identity used for this commit with: git commit --amend --reset-author 3 files changed, 5 insertions(+), 66 deletions(-) delete mode 100755 scripts/create-infrastructure.sh.save mode change 100644 => 100755 scripts/install-qrencode.sh |
$git config --global user.name "ValeryBarai"
|
$git push
Username for 'https://github.com': ValeryBarai Password for 'https://ValeryBarai@github.com': Counting objects: 4, done. Delta compression using up to 4 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 564 bytes | 0 bytes/s, done. Total 4 (delta 1), reused 0 (delta 0) remote: Resolving deltas: 100% (1/1), completed with 1 local object. To https://github.com/ValeryBarai/AWS.git 856c03a..a390751 master -> master |
$rm create-infrastructure.sh
|
$git add -p scripts/initial-command.sh
No changes. |
$git status
On branch master Your branch is up-to-date with 'origin/master'. Untracked files: (use "git add <file>..." to include in what will be committed) scripts/initial-command.sh nothing added to commit but untracked files present (use "git add" to track) |
$git commit -m 'new change'
On branch master Your branch is up-to-date with 'origin/master'. Untracked files: scripts/initial-command.sh nothing added to commit but untracked files present |
$git push
Username for 'https://github.com': ValeryBarai Password for 'https://ValeryBarai@github.com': Everything up-to-date |
$git config --global user.name "ValeryBarai"
|
$git push
Username for 'https://github.com': ValeryBarai Password for 'https://ValeryBarai@github.com': Counting objects: 4, done. Delta compression using up to 4 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 515 bytes | 0 bytes/s, done. Total 4 (delta 0), reused 0 (delta 0) To https://github.com/ValeryBarai/AWS.git a390751..4ac7d1a master -> master |
$git add help
fatal: pathspec 'help' did not match any files |
$git add
Nothing specified, nothing added. Maybe you wanted to say 'git add .'? |
$git add --help
GIT-ADD(1) Git Manual GIT-ADD(1) NAME git-add - Add file contents to the index SYNOPSIS git add [--verbose | -v] [--dry-run | -n] [--force | -f] [--interactive | -i] [--patch | -p] [--edit | -e] [--[no-]all | --[no-]ignore-removal | [--update | -u]] [--intent-to-add | -N] [--refresh] [--ignore-errors] [--ignore-missing] [--chmod=(+|-)x] [--] [<pathspec>...] DESCRIPTION This command updates the index using the current content found in the working tree, to prepare the content ... Add modified contents in the working tree interactively to the index. Optional path arguments may be supplied to limit operation to a subset of the working tree. See “Interactive mode” for details. -p, --patch Interactively choose hunks of patch between the index and the work tree and add them to the index. This gives the user a chance to review the difference before adding modified contents to the index. This effectively runs add --interactive, but bypasses the initial command menu and directly jumps to the patch subcommand. See “Interactive mode” for details. -e, --edit Open the diff vs. the index in an editor and let the user edit it. After the editor was closed, adjust the hunk headers and apply the patch to the index. |
$cd ..
|
$cd AWS/
|
$ls -la
total 20 drwxr-xr-x 4 user user 4096 Dec 20 15:46 . drwxr-xr-x 22 user user 4096 Dec 20 16:26 .. drwxr-xr-x 8 user user 4096 Dec 20 15:50 .git -rw-r--r-- 1 user user 88 Dec 17 16:45 hello.md drwxr-xr-x 2 user user 4096 Dec 20 15:42 scripts |
$cd
|
$ls -la
total 55628 drwxr-xr-x 22 user user 4096 Dec 20 16:26 . drwxr-xr-x 4 root root 4096 Dec 16 14:01 .. drwxr-xr-x 2 user user 4096 Dec 19 14:28 .aws drwxr-xr-x 4 user user 4096 Dec 20 15:46 AWS -rw------- 1 user user 13456 Dec 20 15:31 .bash_history -rw-r--r-- 1 user user 220 May 15 2017 .bash_logout -rw-r--r-- 1 user root 10 Dec 16 14:23 .bash_profile -rw-r--r-- 1 user user 666 Dec 19 14:41 .bashrc drwx------ 10 user user 4096 Dec 19 14:47 .cache ... -rw-r--r-- 1 user user 4109 Dec 19 15:04 .saws.log -rw-r--r-- 1 user user 596 Dec 19 17:05 .sawsrc -rw-r--r-- 1 user user 2256 Dec 19 14:49 .saws.shortcuts drwx------ 2 user user 4096 Dec 19 11:33 .ssh -rw------- 1 user user 12288 Dec 19 11:19 .tatyanaDNS.txt.swp -rw-r--r-- 1 user user 1796 Dec 20 11:48 teacher_script_1.txt drwxr-xr-x 2 user user 4096 Dec 17 12:15 Templates drwxr-xr-x 2 user user 4096 Dec 17 12:15 Videos -rw------- 1 user user 13920 Dec 20 15:42 .viminfo -rw-r--r-- 1 user user 103 Dec 17 14:43 V.json |
$ls -la | grep YAML
|
$ls -la | grep yaml
-rw-r--r-- 1 root root 203 Dec 20 16:26 ec2.yaml |
$more ec2.yaml
|
$vi ec2.yaml
|
$vi ec2.yaml
|
$curl https://raw.githubusercontent.com/ValeryBarai/AWS/scripts/install-qrencode.sh
404: Not Found |
$ aws ec2 run-instances \
#!/bin/sh curl https://raw.githubusercontent.com/sl-2018-12/aws/master/scripts/install-qrencode.sh | bash -s |
$~
start elif [ "$1" = stop ]; then stop else cat <<EOF Usage: $0 start|stop EOF 61,1 97% |
$private_ip_address" \
#!/bin/sh curl https://raw.githubusercontent.com/sl-2018-12/aws/master/scripts/install-qrencode.sh | bash -s |
$~
create-infrastructure.sh initial-command.sh install-qrencode.sh |
$vi scripts/
|
$vi scripts/install-qrencode.sh
|
$sudo /etc/init.d/nginx restart
start elif [ "$1" = stop ]; then stop else cat <<EOF Usage: $0 start|stop EOF 61,1 97% |
$KEY_NAME" \
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ wNext wall while wincmd windo winpos winsize wnext wprevious wq wqall write wsverb wundo wviminfo ~ "scripts/initial-command.sh" 3L, 104C written |
$vi scripts/install-qrencode.sh
|
$scripts/create-infrastructure.sh start
{ "Instances": [ { "Monitoring": { "State": "disabled" }, "PublicDnsName": "", "StateReason": { "Message": "pending", "Code": "pending" ... "Key": "Name" } ], "AmiLaunchIndex": 0 } ], "ReservationId": "r-00f9f96a36044878e", "Groups": [], "OwnerId": "886677986286" } |
$ssh https://www.google.com/search?q=34.241.132.131+%2F12213&ie=utf-8&oe=utf-8
[1] 5878 [2] 5879 [2]+ Done ie=utf-8 |
$https://raw.githubusercontent.com/ValeryBarai/AWS/master/scripts/install-qrencode.sh
bash: https://raw.githubusercontent.com/ValeryBarai/AWS/master/scripts/install-qrencode.sh: No such file or directory |
#!/bin/bash USER_NAME=user10 IMAGE_ID=ami-02fc24d56bc5f3d67 # ami-09693313102a30b2c INSTANCE_TYPE=t2.micro VPC_ID=vpc-04540e242cdfb35de KEY_NAME=user10 SUBNET_ID=subnet-0d00d8b5d01e66e35 SHUTDOWN_TYPE=stop TAGS="ResourceType=instance,Tags=[{Key=installation_id,Value=${USER_NAME}-1},{Key=Name,Value=NAME}]" initial_command() { cat <<EOF #!/bin/sh curl https://raw.githubusercontent.com/sl-2018-12/aws/master/scripts/install-qrencode.sh | bash -s EOF } start_vm() { local private_ip_address="$1" local public_ip="$2" local name="$3" local user_data="$4" local tags=$(echo $TAGS | sed s/NAME/$name/) # local tags=${TAGS/NAME/$name} aws ec2 run-instances \ --image-id "$IMAGE_ID" \ --instance-type "$INSTANCE_TYPE" \ --key-name "$KEY_NAME" \ --subnet-id "$SUBNET_ID" \ --instance-initiated-shutdown-behavior "$SHUTDOWN_TYPE" \ --private-ip-address "$private_ip_address" \ --tag-specifications "$tags" \ --user-data "$user_data" \ --${public_ip} # --security-groups "$security_group" \ # [--block-device-mappings <value>] # [--placement <value>] } get_dns_name() { local instance="$1" aws ec2 describe-instances --instance-ids ${instance} \ | jq -r '.Reservations[0].Instances[0].NetworkInterfaces[0].Association.PublicDnsName' } start() { start_log=$( start_vm 10.2.1.101 associate-public-ip-address ${USER_NAME}-vm1 file://<( initial_command ) ) instance_id=$(echo "${start_log}" | jq -r .Instances[0].InstanceId) # for i in {2..3}; do # start_vm 10.2.1.$((100+i)) no-associate-public-ip-address ${USER_NAME}-vm$i > /dev/null # done sleep 2 dns_name=$(get_dns_name "$instance_id") echo $dns_name } stop() { ids=($( aws ec2 describe-instances \ --query 'Reservations[*].Instances[?KeyName==`'$KEY_NAME'`].InstanceId' \ --output text )) aws ec2 terminate-instances --instance-ids "${ids[@]}" } if [ "$1" = start ]; then start elif [ "$1" = stop ]; then stop else cat <<EOF Usage: $0 start|stop EOF exit 1 fi
Время первой команды журнала | 12:52:49 2018-12-20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Время последней команды журнала | 15:00:42 2018-12-20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Количество командных строк в журнале | 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Процент команд с ненулевым кодом завершения, % | 10.89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Процент синтаксически неверно набранных команд, % | 0.99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Суммарное время работы с терминалом *, час | 1.56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Количество командных строк в единицу времени, команда/мин | 1.08 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Частота использования команд |
|
В журнал автоматически попадают все команды, данные в любом терминале системы.
Для того чтобы убедиться, что журнал на текущем терминале ведётся, и команды записываются, дайте команду w. В поле WHAT, соответствующем текущему терминалу, должна быть указана программа script.
Команды, при наборе которых были допущены синтаксические ошибки, выводятся перечёркнутым текстом:
$ l s-l bash: l: command not found |
Если код завершения команды равен нулю, команда была выполнена без ошибок. Команды, код завершения которых отличен от нуля, выделяются цветом.
$ test 5 -lt 4 |
Команды, ход выполнения которых был прерван пользователем, выделяются цветом.
$ find / -name abc find: /home/devi-orig/.gnome2: Keine Berechtigung find: /home/devi-orig/.gnome2_private: Keine Berechtigung find: /home/devi-orig/.nautilus/metafiles: Keine Berechtigung find: /home/devi-orig/.metacity: Keine Berechtigung find: /home/devi-orig/.inkscape: Keine Berechtigung ^C |
Команды, выполненные с привилегиями суперпользователя, выделяются слева красной чертой.
# id uid=0(root) gid=0(root) Gruppen=0(root) |
Изменения, внесённые в текстовый файл с помощью редактора, запоминаются и показываются в журнале в формате ed. Строки, начинающиеся символом "<", удалены, а строки, начинающиеся символом ">" -- добавлены.
$ vi ~/.bashrc
|
Для того чтобы изменить файл в соответствии с показанными в диффшоте изменениями, можно воспользоваться командой patch. Нужно скопировать изменения, запустить программу patch, указав в качестве её аргумента файл, к которому применяются изменения, и всавить скопированный текст:
$ patch ~/.bashrc |
Для того чтобы получить краткую справочную информацию о команде, нужно подвести к ней мышь. Во всплывающей подсказке появится краткое описание команды.
Если справочная информация о команде есть, команда выделяется голубым фоном, например: vi. Если справочная информация отсутствует, команда выделяется розовым фоном, например: notepad.exe. Справочная информация может отсутствовать в том случае, если (1) команда введена неверно; (2) если распознавание команды LiLaLo выполнено неверно; (3) если информация о команде неизвестна LiLaLo. Последнее возможно для редких команд.
Большие, в особенности многострочные, всплывающие подсказки лучше всего показываются браузерами KDE Konqueror, Apple Safari и Microsoft Internet Explorer. В браузерах Mozilla и Firefox они отображаются не полностью, а вместо перевода строки выводится специальный символ.
Время ввода команды, показанное в журнале, соответствует времени начала ввода командной строки, которое равно тому моменту, когда на терминале появилось приглашение интерпретатора
Имя терминала, на котором была введена команда, показано в специальном блоке. Этот блок показывается только в том случае, если терминал текущей команды отличается от терминала предыдущей.
Вывод не интересующих вас в настоящий момент элементов журнала, таких как время, имя терминала и других, можно отключить. Для этого нужно воспользоваться формой управления журналом вверху страницы.
Небольшие комментарии к командам можно вставлять прямо из командной строки. Комментарий вводится прямо в командную строку, после символов #^ или #v. Символы ^ и v показывают направление выбора команды, к которой относится комментарий: ^ - к предыдущей, v - к следующей. Например, если в командной строке было введено:
$ whoami
user
$ #^ Интересно, кто я?в журнале это будет выглядеть так:
$ whoami
user
Интересно, кто я? |
Если комментарий содержит несколько строк, его можно вставить в журнал следующим образом:
$ whoami
user
$ cat > /dev/null #^ Интересно, кто я?
Программа whoami выводит имя пользователя, под которым мы зарегистрировались в системе. - Она не может ответить на вопрос о нашем назначении в этом мире.В журнале это будет выглядеть так:
$ whoami user
|
Комментарии, не относящиеся непосредственно ни к какой из команд, добавляются точно таким же способом, только вместо симолов #^ или #v нужно использовать символы #=
1 2 3 4Группы команд, выполненных на разных терминалах, разделяются специальной линией. Под этой линией в правом углу показано имя терминала, на котором выполнялись команды. Для того чтобы посмотреть команды только одного сенса, нужно щёкнуть по этому названию.
LiLaLo (L3) расшифровывается как Live Lab Log.
Программа разработана для повышения эффективности обучения Unix/Linux-системам.
(c) Игорь Чубин, 2004-2008