-
Notifications
You must be signed in to change notification settings - Fork 0
/
90-devops.sh
75 lines (64 loc) · 2.54 KB
/
90-devops.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# History control ==================================================================================
# don't put duplicate lines in the history. See bash(1) for more options
readonly HISTCONTROL=ignoredups
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
readonly HISTFILESIZE="20000"
readonly HISTSIZE="20000"
# registra a data juntamente com cada comando
HISTTIMEFORMAT="+%Y%m%d-%T "
readonly HISTFILE="${HOME}/.bash_history"
# append to the history file, don't overwrite it
shopt -s histappend
PROMPT_COMMAND='history -a'
export HISTTIMEFORMAT HISTFILE HISTFILESIZE HISTSIZE HISTCONTROL
# Colors ========================================================================================
color_prompt=yes
# Seta o terminal colorido
if [ "$color_prompt" = yes ]; then
if [[ ${EUID} == 0 ]] ; then
PS1='\[\033[1;38;5;9m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
else
ink=10 #cor
__git_branch='\[\033[1;38;5;${ink}m\]$(git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /)\[\033[01;34m\]'
PS1="\[\033[1;38;5;${ink}m\]\u@\h\[\033[01;34m\] \w $__git_branch\$\[\033[00m\] "
fi
else
PS1='\u@\h:\w\$ '
fi
unset color_prompt
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# Aliases ========================================================================================
if [ -x /usr/bin/fortune ]; then
echo "Fortune:"
fortune
fi
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
alias vi='vim'
alias tm="tail -f /var/log/messages"
alias tapache="tail -f /var/log/httpd/*_log"
alias tnginx="tail -f /var/log/nginx/*.log"
alias l="ls -laF --color=tty"
alias halt="echo 'use shutdown -h now!!!' ; shutdown -h now"
alias tsquid='tail -f /var/log/squid/access.log | perl -pe "s/^\d+\.\d+/localtime $&/e"'
alias compress='tar -I "pigz --best" -cvf'
alias extract="tar xvzf"
alias xcompress='tar -I "pxz --best" -cvf'
alias xextract="tar -Jxxvf"
alias ftpython='echo "Files will be avaliable at $(hostname -I) port 8000" ; ftpython'
alias pull_stage="hub pull-request -b stage -m"
alias pull_master="hub pull-request -b master -m"