start new:
tmux
start new with session name:
tmux new -s myname
#!/bin/sh | |
mongo localhost:27017/mongo run_command.js | |
mongo localhost:27018/mongo run_command.js | |
mongo localhost:27019/mongo run_command.js | |
# if you don't need connection infomation etc., use --quiet option. | |
# http://www.mongodb.org/display/DOCS/--quiet |
db = connect("localhost:27017/test"); | |
var cursor = db.unicorns.find({gender : "m"}); | |
var total = 0; | |
while(cursor.hasNext()) { | |
var obj = cursor.next(); | |
total += (obj.hits || 0); | |
} | |
print(total); |
Fabric is a deployment management framework written in Python which makes remotely managing multiple servers incredibly easy. If you've ever had to issue a change to a group servers, this should look pretty familiar:
for s in $(cat servers.txt); do ssh $s service httpd graceful; done
Fabric improves on this process by providing a suite of functions to run commands on the servers, as well as a number of other features which just aren't possible in a simple for loop. While a working knowledge of Python is helpful when using Fabric, it certainly isn't necessary. This tutorial will cover the steps necessary to get started with the framework and introduce how it can be used to improve on administering groups of servers.
db2 connect to MYDB | |
db2 -x "select tabname from syscat.tables where TABSCHEMA='MYSCHEMA' | |
and type='T'" > tableNames | |
while read TABLE; do | |
db2 EXPORT TO ./exported/$TABLE.del OF DEL lobs to ./exported/lobs | |
lobfile $TABLE xml to ./exported/xml xmlfile $TABLE | |
modified by lobsinsepfiles xmlinsepfiles MESSAGES ./exported/$TABLE.txt | |
"SELECT * FROM MYSCHEMA.$TABLE" | |
done < tableNames |
#!/bin/bash | |
while [ 1 ] | |
do | |
rsync -avz --partial source dest | |
if [ "$?" = "0" ] ; then | |
echo "rsync completed normally" | |
exit | |
else | |
echo "Rsync failure. Backing off and retrying..." |