-
Notifications
You must be signed in to change notification settings - Fork 0
/
aliases.txt
47 lines (36 loc) · 2.56 KB
/
aliases.txt
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
# useful aliases
# when network connection goes down, many procs hang; this kills them in a single blow (because typing on the keyboard can be hard + remembering which processes to kill can be difficult as well)
alias diedie "sudo pkill convert; sudo pkill xwd; sudo pkill curl; sudo pkill grep; sudo pkill sshfs; sudo pkill find; sudo pkill bc-xwd.pl; sudo pkill bc-elec-snap.pl"
alias diediedie "sudo pkill -9 convert; sudo pkill -9 xwd; sudo pkill -9 curl; sudo pkill -9 grep; sudo pkill -9 sshfs; sudo pkill -9 find; sudo pkill -9 bc-xwd.pl; sudo pkill -9 bc-elec-snap.pl"
# nagios status from status.dat (very kludgey)
alias nagstat "egrep 'host_name|plugin_output|current_state|(host|service)status|service_description|check_command' /var/nagios/status.dat | grep -v 'long_plugin_output'"
# cleanup nagios status files that are older than last nagios invocation
# TODO: this should really be done automatically at nagios restart
alias nagclean "find /home/barrycarter/ERR -iname 'nagios.*.err' ! -newer /var/nagios/rw/nagios.cmd | xargs rm"
# check all nagios services
# <h>but mostly show off my insane shell alias</h>
# TODO: make nagios do this at startup somehow?
alias nagcheck "grep host_name /var/nagios/status.dat | sort | uniq | cut -d= -f 2 | xargs -I'{}' echo '['`date +%s`']' 'SCHEDULE_FORCED_HOST_SVC_CHECKS;{};'`date +%s` >> /var/nagios/rw/nagios.cmd"
# start nagios "my way" (sleep sadly needed since nagios doesn't die instantly)
# <h>who needs /etc/init.d anyway!</h>
# this fails if nagios isn't running already; pkill nagios && nagios
# would've been a better option
alias nagstart "echo restarting nagios...; sudo rm /home/barrycarter/ERR/nagios.*.err; sudo pkill nagios; sudo nagios -d /home/barrycarter/BCGIT/NAGIOS/nagios.cfg; sleep 5; nagcheck"
# volume
alias volume "amixer set 'Master Front' \!*"
# how many watts (joules/second) of electricity you're using, if it
# takes your meter n+-1 seconds to go around (assuming you have
# standard 7.2 electric meter)
alias watts 'echo "25920/\!*\n25920/(\!* -1)\n25920/(\!* +1)" | bc'
# just a silly way to do a quick plot
alias qplot 'echo plot \"/tmp/gnuplot.txt\" with linespoints | gnuplot -persist'
# makes locate case-insensitive and stores result in file (I often do
# 'locate', expecting minimal results, but there are lots and they
# scroll off-screen)
alias locate 'locate -i \!* | tee /var/tmp/bc-cmd-locate.txt'
# useful to confirm pkill works
# <h>NOTE: -v does NOT mean verbose!</h>
alias pkill "pkill \!*; pgrep -l \!*"
# I do NOT want "which" aliases to "alias | which...", since that
# breaks "which cd"
unalias which