Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ####My custom tmux conf file #1 -- this shows number of stopped/hung 'ascp' procs/cumulative cpu usage in the tmux status bar
- # If there isn't a session to attach to, create a new one:
- new-session -n $HOST
- set -g default-terminal "screen-256color"
- set -g status-bg black
- set -g status-fg white
- # alignment
- #set-option -g status-justify center
- # status left options
- set-option -g status-left '#[fg=green][#[bg=black,fg=cyan]#S#[fg=green]]'
- set-option -g status-left-length 20
- # window list
- setw -g automatic-rename on
- # status right options
- set-option -g status-right '#[fg=red]Date:#[fg=black]#(uptime | awk \"{ print \\$1 }\")#[fg=red]-bad:#[fg=black]#(./list_zombie_ascp.sh)'
- #set-option -g status-right 'bad:#[fg=black]#(./list_zombie_ascp.sh)'
- # refresh often
- set-option -g status-interval 2
- # longer history
- set -g history-limit 30000
- ##### My custom tmux config #2
- set -g prefix C-a # Make C-a the prefix instead of default
- bind C-a send-prefix # Send to application
- unbind C-b # Unbind C-b
- set -sg escape-time 1 # Remove delay for keystrokes
- setw -g mode-keys vi # Use vi mode
- ### Mouse mode ###
- setw -g mode-mouse on # Toggle mouse mode globally
- set -g mouse-select-pane on # Select pane using mouse
- set -g mouse-resize-pane on # Resize pane using mouse
- set -g mouse-select-window on # Select window with mouse
- setw -g automatic-rename off
- # Key bindings
- set -g base-index 1 # Window numbers start at 1
- setw -g pane-base-index 1 # Pane numbers start at 1
- bind \ split-window -h # Vertical split
- bind | split-window -h # Vertical split
- bind - split-window -v # Horizontal split
- bind x kill-pane # Close current pane
- #bind a send-key C-a # Go to beginning of line
- bind h select-pane -L # Select left pane
- bind j select-pane -D # Select down pane
- bind k select-pane -U # Select up pane
- bind l select-pane -R # Select right pane
- bind -r H resize-pane -L 5 # Resize pane left 5 lines
- bind -r J resize-pane -D 5 # Resize pane down 5 lines
- bind -r K resize-pane -U 5 # Resize pane up 5 lines
- bind -r L resize-pane -R 5 # Resize pane right 5 lines
- bind r source-file ~/.tmux.conf; display-message " ✓ reloaded .tmux.conf" # Reload configuration
- bind -r C-h select-window -t :- # Cycle through windows left
- bind -r C-l select-window -t :+ # Cycle through windows right
- # Switch between windows with arrow keys
- bind -n S-Left previous-window
- bind -n S-Right next-window
- # Create new window with down
- bind -n S-Down new-window
- # 256 Colour terminal
- set -g default-terminal "screen-256color"
- # Buffer Size
- set -g history-limit 5000
- # Mouse Support
- set -g mouse-utf8 on
- set -g mouse-select-pane
- set -g mouse-select-window
- set-option -g mouse-resize-pane on
- bind-key -t vi-copy 'v' begin-selection
- bind-key -t vi-copy 'y' copy-selection
- #set-option -g default-command "reattach-to-user-namespace -l zsh"
- bind C-c run "tmux save-buffer - | reattach-to-user-namespace pbcopy"
- bind C-v run "tmux set-buffer $(reattach-to-user-namespace pbpaste); tmux paste-buffer"
- set -g terminal-overrides 'xterm*:smcup@:rmcup@'
- set-option -g status-right '#[fg=red]Date:#[fg=black]#(uptime | awk \"{ print \\$1 }\")#[fg=red]-bad:#[fg=black]#(./list_zombie_ascp.sh)'
- #set-option -g status-right 'bad:#[fg=black]#(./list_zombie_ascp.sh)'
- ##### cat /list_zombie_ascp.sh
- $ cat ~/list_zombie_ascp.sh
- #!/usr/bin/env bash
- #export PATH="$PATH:/usr/sbin"
- #/usr/bin/sudo lsof -i tcp | grep ascp | awk '{print $2}' | xargs -I proc ps -p proc -o pid,bsdstart,c --no-headers | sort -r | uniq | awk '{ if($2 ~ /[a-zA-z]+/) tot_count+=1; tot_cpu_usage+=$4 } END { print tot_count "/" tot_cpu_usage }'
- pgrep -lf "bin/ascp" | awk '{print $1}' | xargs -I proc ps -p proc -o pid,bsdstart,c,cmd --no-headers | sort -r | uniq | awk '{ if($2 ~ /[a-zA-z]+/) tot_count+=1; tot_cpu_usage+=$4 } END { print tot_count "/" tot_cpu_usage }'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement