Advertisement
Guest User

Untitled

a guest
Aug 1st, 2015
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.31 KB | None | 0 0
  1. ####My custom tmux conf file #1 -- this shows number of stopped/hung 'ascp' procs/cumulative cpu usage in the tmux status bar
  2.  
  3. # If there isn't a session to attach to, create a new one:
  4. new-session -n $HOST
  5.  
  6. set -g default-terminal "screen-256color"
  7.  
  8. set -g status-bg black
  9. set -g status-fg white
  10.  
  11. # alignment
  12. #set-option -g status-justify center
  13.  
  14. # status left options
  15. set-option -g status-left '#[fg=green][#[bg=black,fg=cyan]#S#[fg=green]]'
  16. set-option -g status-left-length 20
  17.  
  18. # window list
  19. setw -g automatic-rename on
  20.  
  21. # status right options
  22. set-option -g status-right '#[fg=red]Date:#[fg=black]#(uptime | awk \"{ print \\$1 }\")#[fg=red]-bad:#[fg=black]#(./list_zombie_ascp.sh)'
  23. #set-option -g status-right 'bad:#[fg=black]#(./list_zombie_ascp.sh)'
  24.  
  25. # refresh often
  26. set-option -g status-interval 2
  27.  
  28. # longer history
  29. set -g history-limit 30000
  30.  
  31.  
  32.  
  33. ##### My custom tmux config #2
  34.  
  35. set -g prefix C-a # Make C-a the prefix instead of default
  36. bind C-a send-prefix # Send to application
  37. unbind C-b # Unbind C-b
  38. set -sg escape-time 1 # Remove delay for keystrokes
  39. setw -g mode-keys vi # Use vi mode
  40.  
  41. ### Mouse mode ###
  42.  
  43. setw -g mode-mouse on # Toggle mouse mode globally
  44. set -g mouse-select-pane on # Select pane using mouse
  45. set -g mouse-resize-pane on # Resize pane using mouse
  46. set -g mouse-select-window on # Select window with mouse
  47.  
  48. setw -g automatic-rename off
  49.  
  50. # Key bindings
  51. set -g base-index 1 # Window numbers start at 1
  52. setw -g pane-base-index 1 # Pane numbers start at 1
  53. bind \ split-window -h # Vertical split
  54. bind | split-window -h # Vertical split
  55. bind - split-window -v # Horizontal split
  56. bind x kill-pane # Close current pane
  57. #bind a send-key C-a # Go to beginning of line
  58. bind h select-pane -L # Select left pane
  59. bind j select-pane -D # Select down pane
  60. bind k select-pane -U # Select up pane
  61. bind l select-pane -R # Select right pane
  62.  
  63. bind -r H resize-pane -L 5 # Resize pane left 5 lines
  64. bind -r J resize-pane -D 5 # Resize pane down 5 lines
  65. bind -r K resize-pane -U 5 # Resize pane up 5 lines
  66. bind -r L resize-pane -R 5 # Resize pane right 5 lines
  67.  
  68. bind r source-file ~/.tmux.conf; display-message " ✓ reloaded .tmux.conf" # Reload configuration
  69.  
  70. bind -r C-h select-window -t :- # Cycle through windows left
  71. bind -r C-l select-window -t :+ # Cycle through windows right
  72.  
  73. # Switch between windows with arrow keys
  74. bind -n S-Left previous-window
  75. bind -n S-Right next-window
  76.  
  77. # Create new window with down
  78. bind -n S-Down new-window
  79.  
  80. # 256 Colour terminal
  81. set -g default-terminal "screen-256color"
  82.  
  83. # Buffer Size
  84. set -g history-limit 5000
  85.  
  86. # Mouse Support
  87. set -g mouse-utf8 on
  88. set -g mouse-select-pane
  89. set -g mouse-select-window
  90. set-option -g mouse-resize-pane on
  91.  
  92. bind-key -t vi-copy 'v' begin-selection
  93. bind-key -t vi-copy 'y' copy-selection
  94.  
  95. #set-option -g default-command "reattach-to-user-namespace -l zsh"
  96. bind C-c run "tmux save-buffer - | reattach-to-user-namespace pbcopy"
  97. bind C-v run "tmux set-buffer $(reattach-to-user-namespace pbpaste); tmux paste-buffer"
  98.  
  99. set -g terminal-overrides 'xterm*:smcup@:rmcup@'
  100.  
  101.  
  102. set-option -g status-right '#[fg=red]Date:#[fg=black]#(uptime | awk \"{ print \\$1 }\")#[fg=red]-bad:#[fg=black]#(./list_zombie_ascp.sh)'
  103. #set-option -g status-right 'bad:#[fg=black]#(./list_zombie_ascp.sh)'
  104.  
  105.  
  106. ##### cat /list_zombie_ascp.sh
  107. $ cat ~/list_zombie_ascp.sh
  108. #!/usr/bin/env bash
  109.  
  110. #export PATH="$PATH:/usr/sbin"
  111. #/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 }'
  112. 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