How to Set Up Bash Shell Aliases

Goal

Learn how to set up shell aliases for your most common commands to make your work easier, faster, and less error prone.

Learn

Edit your

~/.bash_profile

working within the current Datameer installation directory and add the following aliases: 

alias dmpid='ps -ef | grep -i "java.*jetty.*datameer" | grep -v grep | tr -s " " | cut -d " " -f2'
alias dmver='ps -ef | grep -i "java.*datameer" | grep -v grep'
alias dmstart='./bin/conductor.sh start'
alias dmstop='./bin/conductor.sh stop'
alias dmcheck='./bin/conductor.sh check' alias dmkill="kill `dmpid`"
alias dmlog="tail -F logs/conductor.log logs/jvm-stdout.log logs/$(date +"%Y_%m_%d").stderrout.log /var/run/$(id -un)/*.* jetty.state"
alias dmmon='while true; echo -n "["$(date +"%Y-%m-%d %H:%M:%S")"] "; do ps -p `dmpid` -o %cpu,%mem --no-heading; sleep 10; done'
alias dmpath='readlink `pwd`; pwd'
alias dmdap='mysql -udap -pdap dap -Bse'
alias dmsqlping='for ((i=1; i<=5; i++)); do time -p dmdap "START TRANSACTION; INSERT INTO test_entity2 (version) VALUES ('1'); UPDATE test_entity2 SET version = 2 WHERE version = 1; DELETE FROM test_entity2 WHERE version = 2; ROLLBACK;"; echo; sleep 1; done'
alias jettyconf='java -jar start.jar --list-config'
alias classpath='yarn classpath | tr ":" ","'

To execute these commands, you can either re-load the .bash_profile via

source ~/.bash_profile

or close the session and login again. After that, use the new aliases you have created in your shell.

Further Information

The dmlog alias 

alias dmlog='tail -F logs/conductor.log logs/jvm-stdout.log logs/`date +"%Y_%m_%d"`.stderrout.log /var/run/$(id -un)/*.* jetty.state'

will cover the whole Datameer service boot process.

How to Check if the Datameer Application Database is Running and Accessible