wiki:jazz/09-09-11

Version 10 (modified by jazz, 15 years ago) (diff)

--

2009-09-11

  • [陽明] 長久以來,/etc/hosts 對於 MPICH2 就容易造成一些困擾,今天又發現對 torque 也有影響。
    • [狀況]
      • /etc/hosts

        old new  
        11127.0.0.1      localhost
        2 140.X.X.X bio2.classcloud.org bio037
        3 192.168.128.254 bio-eth0
         2140.X.X.X bio2.classcloud.org
         3192.168.128.254 bio-eth0 bio037
        44192.168.128.13 bio013
        55192.168.128.14 bio014
        66192.168.128.15 bio015
  • [課程] 還原電腦教室 A 的 Hadoop Image
    #!/bin/bash
    /opt/drbl/sbin/drbl-ocs -b -g auto -e1 auto -e2 -x -j2 -o1 -p poweroff --clients-to-wait 31 --max-time-to-wait 300 --broadcast -h "192.168.100.1 192.168.100.2 192.168.100.3 192.168.100.4 192.168.100.5 192.168.100.6 192.168.100.7 192.168.100.8 192.168.100.9 192.168.100.10 192.168.100.11 192.168.100.12 192.168.100.13 192.168.100.14 192.168.100.15 192.168.100.16 192.168.100.17 192.168.100.18 192.168.100.19 192.168.100.20 192.168.100.21 192.168.100.22 192.168.100.23 192.168.100.24 192.168.100.25 192.168.100.26 192.168.100.27 192.168.100.28 192.168.100.29 192.168.100.30 192.168.100.31" -l zh_TW.UTF-8 startdisk multicast_restore 2009-08-24-Hadoop_Class sda
    /opt/drbl/sbin/dcs -h "192.168.100.1 192.168.100.2 192.168.100.3 192.168.100.4 192.168.100.5 192.168.100.6 192.168.100.7 192.168.100.8 192.168.100.9 192.168.100.10 192.168.100.11 192.168.100.12 192.168.100.13 192.168.100.14 192.168.100.15 192.168.100.16 192.168.100.17 192.168.100.18 192.168.100.19 192.168.100.20 192.168.100.21 192.168.100.22 192.168.100.23 192.168.100.24 192.168.100.25 192.168.100.26 192.168.100.27 192.168.100.28 192.168.100.29 192.168.100.30 192.168.100.31" Wake-on-LAN
    
    ### 刪掉上次留著的視窗分頁紀錄 ###
    drbl:~# dsh -a rm /home/hadooper/.mozilla/firefox/yq376prp.default/sessionstore.js        
    ### 替換瀏覽器預設首頁為新的 URL ###
    drbl:~# dsh -a "cat /home/hadooper/.mozilla/firefox/yq376prp.default/prefs.js | sed 's#NCHCCloudCourse090824#NCHCCloudCourse090914#' > /home/hadooper/.mozilla/firefox/yq376prp.default/prefs.js.new"
    drbl:~# dsh -a "mv /home/hadooper/.mozilla/firefox/yq376prp.default/prefs.js.new /home/hadooper/.mozilla/firefox/yq376prp.default/prefs.js"
    drbl:~# dsh -a grep trac.nchc.org.tw /home/hadooper/.mozilla/firefox/yq376prp.default/prefs.js
    

Open Source : Perl

Open Source : Python

Message Queue

SQLite

  • Embedding an SQL Database with SQLite - 有講到 SQLite 的架構
  • SQLite examples with Bash, Perl and Python - 用很簡潔的方式介紹 Bash, Perl 跟 Python 如何存取 SQLite
    #!/usr/bin/perl -w
    use DBI;
    use strict;
    my $db = DBI->connect("dbi:SQLite:test.db", "", "",
    {RaiseError => 1, AutoCommit => 1});
    
    $db->do("CREATE TABLE n (id INTEGER PRIMARY KEY, f TEXT, l TEXT)");
    $db->do("INSERT INTO n VALUES (NULL, 'john', 'smith')");
    my $all = $db->selectall_arrayref("SELECT * FROM n");
    
    foreach my $row (@$all) {
    my ($id, $first, $last) = @$row;
    print "$id|$first|$lastn";
    }
    
    #!/usr/bin/python
    from pysqlite2 import dbapi2 as sqlite
    
    db = sqlite.connect('test.db')
    cur = db.cursor()
    cur.execute('CREATE TABLE n (id INTEGER PRIMARY KEY, f TEXT, l TEXT)')
    db.commit()
    cur.execute('INSERT INTO n (id, f, l) VALUES(NULL, "john", "smith")')
    db.commit()
    cur.execute('SELECT * FROM n')
    print cur.fetchall()
    
    #!/bin/bash
    sqlite3 test.db  "create table n (id INTEGER PRIMARY KEY,f TEXT,l TEXT);"
    sqlite3 test.db  "insert into n (f,l) values ('john','smith');"
    sqlite3 test.db  "select * from n";
    
  • PHP: SQLite - Manual - PHP 存取 SQLite 的原文手冊
  • PHP-SQLite - 資策會技術支援資料庫

OpenPBS / Torque