Commit 0871594f authored by DBX12's avatar DBX12 Committed by Marc Cornellà

systemadmin: refactor plugin and fix README (#7295)

parent ecb46c3e
This diff is collapsed.
......@@ -12,14 +12,6 @@
#
# ------------------------------------------------------------------------------
function retval() {
if [[ -z $1 ]];then
echo '.'
else
echo $1
fi
}
function retlog() {
if [[ -z $1 ]];then
echo '/var/log/nginx/access.log'
......@@ -29,8 +21,8 @@ function retlog() {
}
alias ping='ping -c 5'
alias clr='clear;echo "Currently logged in on $(tty), as $USER in directory $PWD."'
alias path='echo -e ${PATH//:/\\n}'
alias clr='clear; echo Currently logged in on $TTY, as $USER in directory $PWD.'
alias path='print -l $path'
alias mkdir='mkdir -pv'
# get top process eating memory
alias psmem='ps -e -orss=,args= | sort -b -k1,1n'
......@@ -43,10 +35,10 @@ alias hist10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10'
# directory LS
dls () {
ls -l | grep "^d" | awk '{ print $9 }' | tr -d "/"
print -l *(/)
}
psgrep() {
ps aux | grep "$(retval $1)" | grep -v grep
ps aux | grep "${1:-.}" | grep -v grep
}
# Kills any process that matches a regexp passed to it
killit() {
......@@ -54,10 +46,10 @@ killit() {
}
# list contents of directories in a tree-like format
if [ -z "\${which tree}" ]; then
tree () {
find $@ -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
}
if ! (( $+commands[tree] )); then
tree () {
find $@ -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
}
fi
# Sort connection state
......@@ -97,7 +89,7 @@ syn20() {
# Printing process according to the port number
port_pro() {
netstat -ntlp | grep "$(retval $1)" | awk '{print $7}' | cut -d/ -f1
netstat -ntlp | grep "${1:-.}" | awk '{print $7}' | cut -d/ -f1
}
# top10 of gain access to the ip address
......@@ -134,7 +126,7 @@ httpstatus() {
# Delete 0 byte file
d0() {
find "$(retval $1)" -type f -size 0 -exec rm -rf {} \;
find "${1:-.}" -type f -size 0 -exec rm -rf {} \;
}
# gather external ip address
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment