Home |  MySQL Buzz |  FAQ |  Feeds |  Submit your blog feed |  Feedback |  Archive |  Aggregate feed RSS 2.0 English Deutsch Español Français Italiano 日本語 Русский Português 中文
Previous 30 Newer Entries Showing entries 31 to 40

Displaying posts with tag: bash (reset)

Gentlemen, Slap your Engines!
Employee +0 Vote Up -0Vote Down

Once again, I was unable to attend all of the sessions I wanted to at this year's User Converence, but I was happy to make it to Bob Burgess' talk on bash scripting with mysql. The slides and examples aren't up yet, but when they are (which may be as you read this, check the last link), they would probably also be a great tutorial.


So, I got bore\^D\^D\^D\^D inspired later that day to put some of the practices into use, and worked up a script to run mysqlslap in various ways against a server, and then added a couple funcitons to try it out on each storage engine. The script is below in its entirety - bash scripters, please be kind in your comments. No, I didn't write all this just for the pun


  [Read more...]
Gentlemen, Slap your Engines!
Employee +0 Vote Up -0Vote Down

Once again, I was unable to attend all of the sessions I wanted to at this year's User Converence, but I was happy to make it to Bob Burgess' talk on bash scripting with mysql. The slides and examples aren't up yet, but when they are (which may be as you read this, check the last link), they would probably also be a great tutorial.


So, I got bore\^D\^D\^D\^D inspired later that day to put some of the practices into use, and worked up a script to run mysqlslap in various ways against a server, and then added a couple funcitons to try it out on each storage engine. The script is below in its entirety - bash scripters, please be kind in your comments. No, I didn't write all this just for the pun


  [Read more...]
RESET SLAVE, bash edition
+0 Vote Up -0Vote Down

Nearly every job advertisement for MySQL DBA positions asks for ’shell scripting’, so I decided to investigate what it is. I remembered some performance training, where I was told how forking is bad, and one should attempt to use shell features as much as possible (like, avoid paths to something, what can be used by builtin (e.g. don’t use /usr/bin/[, just pure [ instead )

I tried to automate one MySQL DBA task (reinitializing slave after relay log corruption or after copying in cloned dataset from other server) using just bash - and it kind of worked. From now on I can put 'Shell scripting' proudly on my resume :-)

Next step - learn JCL (some people think this is funny :)

What was your most complicated task solved with shell scripts? :)

  [Read more...]


	
Mastering The Linux Shell – Bash Shortcuts Explained (Now With Cheat Sheets)
+0 Vote Up -0Vote Down

During my day-to-day activities, I use the Bash shell a lot. My #1 policy is to optimize the most frequently used activities as much as possible, so I’ve compiled these handy bash shortcuts and hints (tested in SecureCRT on Windows and Konsole on Linux). The article only touches on the default bash mode – emacs, not vi. If you haven’t specifically assigned your shell mode to vi (set –o vi), you’re almost certainly using the emacs mode. Learn these and your shell productivity will skyrocket, I guarantee it.

Update #1: In response to a few people saying this list is too short and “[he] could've added something to it, to atleast make it look longer” (quote from one of

  [Read more...]
KDE Konsole Backgrounds and ssh
+0 Vote Up -0Vote Down

If you are a GUI-oriented person, you need not read this. But if you are like me, you make heavy use of the console. If you are managing many machines as well as your own Linux workstation, it’s VERY important to know where your console session is.

Too many times in the past I had wanted to bring down my workstation, and would type “shutdown” or “reboot” in the console window, only to find out to my horrors that the console was really a remote session to one of my web servers serving up hundreds of web sites.

Whoops!

Well, that prompted me into developing a solution where I can tell at a glance where I happened to be logged in. This way,  I wouldn’t be in danger of issuing dangerous commands on the wrong server. And if you are working for


  [Read more...]
Summary of beCamp 2008
+0 Vote Up -0Vote Down

Yesterday I went to beCamp 2008 along with four roomfuls of other people interested in technology (perhaps close to 100 people total). The conference was a lot of fun. Not everything went as planned, but that was as planned. This was an Open Spaces conference and I thought it worked very well. From an email Eric Pugh sent:

Basically it all boils down to:

Open Space is the Law of Two Feet: if anyone finds themselves in a place where they are neither learning nor contributing they should move to somewhere more productive. And from the law flow four principles:

  • Whoever comes are the right people
  • Whatever happens is the only thing that could have
  • Whenever it starts
  [Read more...]
Command Line History
+0 Vote Up -0Vote Down

Inspired by the Rail Spikes:

bash-3.2$ history 1000 | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head

228 cd

167 git

10 ssh

10 DEPLOY=production

6 sudo

6 pwd

6 ./script/import_views.rb

5 rm

4 rake

4 mv

bash-3.2$

Really interesting stats, I’d never guess that git is used more than ssh on my desktop (I’m a remote worker and mysql consultant so I ssh really often).

Skip duplicate entries in a slave
+0 Vote Up -0Vote Down
A
Saying What You Mean
+0 Vote Up -0Vote Down

Ah, the perils of working in a shared, client environment. One client has us using a login that is not exclusive to us. I prefer using bash; the client is set to use zsh. This is not a problem in and of itself.

However, there is a section in the .profile that is causing me issues:

if [ -f /usr/bin/ksh ]; then
        /usr/bin/ksh -o vi
        exit
fi

So, “If ksh exists, run it with some options to edit history with vi-like commands”. Except what we really want is “If you’re using the ksh as a shell, . . . .”

So I added a modification, and now all is fine.

if [ -f /usr/bin/ksh ]; then
        if [ "$SHELL" = "/usr/bin/ksh" ]; then
                /usr/bin/ksh -o vi
                exit
        fi
fi

(not all my problems are MySQL related!)

Suddenly I Tee .. or how to log your mysql shell output to a log file
+0 Vote Up -0Vote Down

A lot of you may already know this, but I am willing to bet there are more that don’t. I’m talking about the tee command in the bash shell, and in MySQL. For our purposes, we’ll talk about the tee command in MySQL.

Problem: You have a series of SQL statements whose results take up a few screens worth of output, and you need to take this output and send it to someone else (A DBA, MySQL Support, your mentor). You could just do a copy/paste from your terminal, but what if you realized in the end that your scroll back buffer isn’t as large as you thought it was?

Solution: Tee. Apparently, the mysql client comes with tee.

mysqlshell> tee mysqlog.sql ;
Logging to file ‘mysqlog.sql’
use dbname;



  [Read more...]
Previous 30 Newer Entries Showing entries 31 to 40

Planet MySQL © 1995, 2014, Oracle Corporation and/or its affiliates   Legal Policies | Your Privacy Rights | Terms of Use

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.