forked from tchernicum/bcapps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aliases.txt
69 lines (51 loc) · 3.85 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# 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
# pull weather from my site (must use dots in name)
alias weather "curl \!*.weather.94y.info"
# run a single nagios test
alias nagtest "sudo /home/barrycarter/BCGIT/bc-call-func.pl run_nagios_test \!*"
alias nagiostest "echo 'this is obsolete; use nagtest instead'"
# logs me into bcinfo3 into a new local screen and starts remote screen
alias bcinfo3 "screen -t BC3 ssh -i /home/barrycarter/.ssh/id_rsa.bc -tt root@bcinfo3 screen -d -R"
# rsyncs to bcinfo3 (my new plugin is so awesome,I even sync it to my old site)
alias bcinfo3sync "cd /home/barrycarter/BCGIT; \rsync -e 'ssh -i /home/barrycarter/.ssh/id_rsa.bc' -Pvzrlpt *.pl */*.pl root@bcinfo3:/usr/local/bin/; \rsync -Pvzrlpt -e 'ssh -i /home/barrycarter/.ssh/id_rsa.bc' /home/barrycarter/BCGIT/BCINFO3/ root@bcinfo3:/; \rsync -Pvzrlpt -e 'ssh -i /home/barrycarter/.ssh/id_rsa.bc' /home/barrycarter/BCGIT/BCINFO3/sites/wordpress/wp-content/plugins/ root@bcinfo:/usr/share/wordpress/wp-content/plugins/"
# chmods all Perl scripts to +x (something I tend to be bad about)
alias perlfix "find /home/barrycarter/PERL /home/barrycarter/BCGIT -iname '*.pl' | xargs chmod +x"
# easier access to datediff subroutine
alias datediff "bc-call-func.pl datediff"
# check if word is in WWF dictionary
alias wwf "bzfgrep -ix \!* /home/barrycarter/BCGIT/WWF/wwf.txt.bz2"