发布新日志

  • set static ip address

    2008-11-12 16:05:11

    Modify some files to set static ip address:
    /etc/hosts
    /etc/hostname.bge0   (hostname)
    /etc/defaultrouter
    /etc/nodename             (hostname)
    /etc/resolv.conf
    /etc/netmasks
    /etc/nsswitch.conf
  • installation solaris 9 log

    2008-11-12 16:02:09

    sc> break
    Are you sure you want to send a break to the system [y/n]? y
    sc> console -f
    Warning: User < > currently has write permission to this console and forcibly removing them will terminate any current write action]
    SC Alert: SC Request to send Break to host.

    Warning: User < > currently has write permission to this console and forcibly removing them will terminate any current write action]
    Warning: User < > currently has write permission to this console and forcibly re
    Warning: User < > currently has write permission to this console and forcibly re
    moving them will terminate any current write actions and all work will be lost.
     Would you like to continue? [y/n]y
    Enter #. to return to ALOM.

    {0} ok banner

    Sun Fire V210, No Keyboard
    Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
    OpenBoot 4.18.10, 4096 MB memory installed, Serial #73641178.
    Ethernet address 0:14:4f:63:ac:da, Host ID: 8463acda.

     

    {0} ok boot cdrom

    SC Alert: Host System has Reset
    Probing system devices
    Probing memory
    Probing I/O buses

    Sun Fire V210, No Keyboard
    Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
    OpenBoot 4.18.10, 4096 MB memory installed, Serial #73641178.
    Ethernet address 0:14:4f:63:ac:da, Host ID: 8463acda.

     

    Rebooting with command: boot cdrom
    Boot device: /pci@1e,600000/ide@d/cdrom@0,0:f  File and args:
    SunOS Release 5.9 Version Generic_118558-11 64-bit
    Copyright 1983-2003 Sun Microsystems, Inc.  All rights reserved.
    Use is subject to license terms.
    Hardware watchdog enabled
    SC unretrieved msg MAR 04 01:41:26 2008 UTC [Host System has Reset]
    Configuring /dev and /devices
    Using RPC Bootparams for network configuration information.
    Skipping interface bge3
    Skipping interface bge2
    Skipping interface bge1
    Skipping interface bge0
    Searching for configuration file(s)...
    Search complete.

     

     

     

     

     

     

     

     

     

     

     


    Select a Language

       0. English
       1. French
       2. German
       3. Italian
       4. Japanese
       5. Korean
       6. Simplified Chinese
       7. Spanish
       8. Swedish
       9. Traditional Chinese

    Please make a choice (0 - 9), or press h or ? for help: 0

     

     

     

     

     

     

     

     

     

     

     


    Select a Locale

       0. English (C - 7-bit ASCII)
       1. Albania (ISO8859-2)
       2. Australia (ISO8859-1)
       3. Belgium-Flemish (ISO8859-1)
       4. Belgium-Flemish (ISO8859-15 - Euro)
       5. Bosnia (ISO8859-2)
       6. Brazil (ISO8859-1)
       7. Brazil (UTF-8)
       8. Bulgaria (ISO8859-5)
       9. Canada-English (ISO8859-1)
      10. Catalan, Spain (ISO8859-1)
      11. Catalan, Spain (ISO8859-15 - Euro)
      12. Croatia (ISO8859-2)
      13. Czech Republic (ISO8859-2)
      14. Denmark (ISO8859-1)
      15. Denmark (ISO8859-15 - Euro)
      16. Egypt (ISO8859-6)
      17. Egypt (UTF-8)
      18. Estonia (ISO8859-15)

    Press Return to show more choices.
    Please make a choice (0 - 59), or press h or ? for help: 0

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    What type of terminal are you using?
     1) ANSI Standard CRT
     2) DEC VT52
     3) DEC VT100
     4) Heathkit 19
     5) Lear Siegler ADM31
     6) PC Console
     7) Sun Command Tool
     8) Sun Workstation
     9) Televideo 910
     10) Televideo 925
     11) Wyse Model 50
     12) X Terminal Emulator (xterms)
     13) CDE Terminal Emulator (dtterm)
     14) Other
    Type the number of your choice and press Return: 1
    The system is coming up. Please wait.
    Begin system identification...
    in.rdisc: No interfaces up
    - The Solaris Installation Program ---------------------------------------------

      The Solaris installation program is divided into a series of short sections
      where you'll be prompted to provide information for the installation. At
      the end of each section, you'll be able to change the selections you've
      made before continuing.

      About navigation...
            - The mouse cannot be used
            - If your keyboard does not have function keys, or they do not
              respond, press ESC; the legend at the bottom of the screen
    --------------------------------------------------------------------------------
    - Identify This System ---------------------------------------------------------

      On the next screens, you must identify this system as networked or
      non-networked, and set the default time zone and date/time.

      If this system is networked, the software will try to find the information
      it needs to identify your system; you will be prompted to supply any
      information it cannot find.

    --------------------------------------------------------------------------------
    - Network Connectivity ---------------------------------------------------------

      Specify Yes if the system is connected to the network by one of the Solaris
      or vendor network/communication Ethernet cards that are supported on the
      Solaris CD. See your hardware documentation for the current list of
      supported cards.
      Specify No if the system is connected to a network/communication card that
      is not supported on the Solaris CD, and follow the instructions listed under
      Help.


          Networked
          ---------
          [X] Yes
    --------------------------------------------------------------------------------
    - DHCP -------------------------------------------------------------------------

      On this screen you must specify whether or not this system should use DHCP
      for network interface configuration.  Choose Yes if DHCP is to be used, or
      No if the interfaces are to be configured manually.

      NOTE: DHCP support will not be enabled, if selected, until after the system
      reboots.

          Use DHCP
          --------
          [ ] Yes
    --------------------------------------------------------------------------------
    - Primary Network Interface ----------------------------------------------------

      On this screen you must specify which of the following network adapters is
      the system's primary network interface.  Usually the correct choice is the
      lowest number.  However, do not guess; ask your system administrator if
      you're not sure.

      > To make a selection, use the arrow keys to highlight the option and
          Primary network interface
          -------------------------
          [X] bge0
          [ ] bge1
          [ ] bge2
    --------------------------------------------------------------------------------
    - Host Name --------------------------------------------------------------------

      On this screen you must enter your host name, which identifies this system
      on the network.  The name must be unique within your domain; creating a
      duplicate host name will cause problems on the network after you install
      Solaris.

      A host name must be at least two characters; it can contain letters, digits,
    --------------------------------------------------------------------------------
    - IP Address -------------------------------------------------------------------

      On this screen you must enter the Internet Protocol (IP) address for this
      system.  It must be unique and follow your site's address conventions, or a
      system/network failure could result.

      IP addresses contain four sets of numbers separated by periods (for example
    --------------------------------------------------------------------------------
        IP address: 192.168.120.13


        IP address: 192.168.120.13


    - Subnets ----------------------------------------------------------------------

      On this screen you must specify whether this system is part of a subnet.  If
      you specify incorrectly, the system will have problems communicating on the
      network after you reboot.

      > To make a selection, use the arrow keys to highlight the option and
          System part of a subnet
          -----------------------
          [X] Yes
    --------------------------------------------------------------------------------
    - Netmask ----------------------------------------------------------------------

      On this screen you must specify the netmask of your subnet.  A default
      netmask is shown; do not accept the default unless you are sure it is
      correct for your subnet.  A netmask must contain four sets of numbers
    --------------------------------------------------------------------------------
    - IPv6 -------------------------------------------------------------------------

      On this screen you should specify whether or not IPv6, the next generation
      Internet Protocol, will be enabled on this machine.  Enabling IPv6 will have
      no effect if this machine is not on a network that provides IPv6 service.
      IPv4 service will not be affected if IPv6 is enabled.

      > To make a selection, use the arrow keys to highlight the option and
          Enable IPv6
          -----------
          [ ] Yes
    --------------------------------------------------------------------------------
      Please wait...
    --------------------------------------------------------------------------------
    - Set the Default Route --------------------------------------------------------

      To specify the default route, you can let the software try to detect one
      upon reboot, you can specify the IP address of the router, or you can choose
      None.  Choose None if you do not have a router on your subnet.

      > To make a selection, use the arrow keys to select your choice and press
          Default Route
          --------------------------
          [X] Detect one upon reboot
          [ ] Specify one
    --------------------------------------------------------------------------------
          [X] Detect one upon reboot
          [ ] Detect one upon reboot
    - Default Route IP Address -----------------------------------------------------

      Enter the IP address of  the default route. This entry will be placed in the
      /etc/defaultrouter file and will be the default route after you reboot
    --------------------------------------------------------------------------------
    - Confirm Information ----------------------------------------------------------

      > Confirm the following information.  If it is correct, press F2;
                        Networked: Yes
                         Use DHCP: No
        Primary network interface: bge0
                        Host name: sunshapp13
                       IP address: 192.168.120.13
          System part of a subnet: Yes
                          Netmask: 255.255.255.0
                      Enable IPv6: No
                    Default Route: Specify one
    --------------------------------------------------------------------------------
      Just a moment...
    --------------------------------------------------------------------------------

    --------------------------------------------------------------------------------
    - Configure Security Policy: ---------------------------------------------------

      Specify Yes if the system will use the Kerberos security mechanism.

      Specify No if this system will use standard UNIX security.

          Configure Kerberos Security
          ---------------------------
          [ ] Yes
    --------------------------------------------------------------------------------
    - Confirm Information ----------------------------------------------------------

      > Confirm the following information.  If it is correct, press F2;
    --------------------------------------------------------------------------------
      Please wait...
    --------------------------------------------------------------------------------

    --------------------------------------------------------------------------------
    - Name Service -----------------------------------------------------------------

      On this screen you must provide name service information.  Select the name
      service that will be used by this system, or None if your system will either
      not use a name service at all, or if it will use a name service not listed
      here.

      > To make a selection, use the arrow keys to highlight the option
          Name service
          ------------
          [X] NIS+
          [ ] NIS
          [ ] DNS
          [ ] LDAP
    --------------------------------------------------------------------------------
          [X] NIS+
          [ ] NIS
          [ ] DNS
          [ ] LDAP
          [ ] LDAP
          [ ] DNS
          [ ] NIS+
          [ ] NIS
    - Domain Name ------------------------------------------------------------------

      On this screen you must specify the domain where this system resides.  Make
    --------------------------------------------------------------------------------
    - DNS Server Addresses ---------------------------------------------------------

      On this screen you must enter the IP address of your DNS server(s).  You
      must enter at least one address.  IP addresses must contain four sets of
        Server's IP address:
        Server's IP address:
    --------------------------------------------------------------------------------
    - DNS Search List --------------------------------------------------------------

      On this screen you can enter a list of domains that will be searched when a
      DNS query is made.  If you do not enter any domains, DNS will only search
      the DNS domain chosen for this system.  The domains entered, when
        Search domain:
        Search domain:
        Search domain:
        Search domain:
        Search domain:
    --------------------------------------------------------------------------------
    - Confirm Information ----------------------------------------------------------

      > Confirm the following information.  If it is correct, press F2;
              Name service: DNS
               Domain name: 192.168.120.18
    --------------------------------------------------------------------------------
      Just a moment...
    --------------------------------------------------------------------------------

    --------------------------------------------------------------------------------
    - Name Service Error -----------------------------------------------------------

      Unable to find an address entry for sunshapp13 with the specified DNS
          Enter new name service information?
          -----------------------------------
          [X] Yes
    --------------------------------------------------------------------------------
          [X] Yes
          [ ] Yes
     done.
    - Time Zone --------------------------------------------------------------------

      On this screen you must specify your default time zone.  You can specify a
      time zone in three ways:  select one of the continents or oceans from the
      list, select other - offset from GMT, or other - specify time zone file.

      > To make a selection, use the arrow keys to highlight the option and
          Continents and Oceans
          ----------------------------------
      -   [ ] Africa
      |   [ ] Americas
      |   [ ] Antarctica
      |   [ ] Arctic Ocean
      |   [ ] Asia
      |   [ ] Atlantic Ocean
      |   [ ] Australia
      |   [ ] Europe
      v   [ ] Indian Ocean

    --------------------------------------------------------------------------------
      -   [ ] Africa
      |   [ ] Americas
      |   [ ] Antarctica
      |   [ ] Arctic Ocean
    - Country or Region ------------------------------------------------------------

      > To make a selection, use the arrow keys to highlight the option and
          Countries and Regions
          ------------------------
      -   [ ] Afghanistan
      |   [ ] Armenia
      |   [ ] Azerbaijan
      |   [ ] Bahrain
      |   [ ] Bangladesh
      |   [ ] Bhutan
      |   [ ] Brunei
      |   [ ] Cambodia
      |   [ ] China
      |   [ ] Cyprus
      |   [ ] East Timor
      |   [ ] Georgia
      v   [ ] Hong Kong

    --------------------------------------------------------------------------------
      -   [ ] Afghanistan
      |   [ ] Armenia
      |   [ ] Azerbaijan
      |   [ ] Bahrain
      |   [ ] Bangladesh
      |   [ ] Bhutan
      |   [ ] Brunei
      |   [ ] Cambodia
      Please wait...
    --------------------------------------------------------------------------------

    --------------------------------------------------------------------------------
    - Date and Time ----------------------------------------------------------------

      > Accept the default date and time or enter
        new values.

      Date and time: 2008-03-04 09:54

        Year   (4 digits) : 2008
        Month  (1-12)     : 03
        Day    (1-31)     : 04
        Hour   (0-23)     : 09
      Date and time: 2008-03-04 09:54

    --------------------------------------------------------------------------------
    - Confirm Information ----------------------------------------------------------

      > Confirm the following information.  If it is correct, press F2;
            Time zone: PRC
    --------------------------------------------------------------------------------
      Please wait...
    --------------------------------------------------------------------------------

    --------------------------------------------------------------------------------
    System identification is completed.
    System identification complete.
    Generating software table of contents [this may take a few minutes...]
    Table of contents complete.
    Starting Solaris installation program...
    Executing JumpStart preinstall phase...
    Searching for SolStart directory...
    Checking rules.ok file...
    Using begin scrīpt: install_begin
    Using finish scrīpt: patch_finish
    Executing SolStart preinstall phase...
    Executing begin scrīpt "install_begin"...
    Begin scrīpt install_begin execution completed.
    - Solaris Interactive Installation ---------------------------------------------

      This system is upgradable, so there are two ways to install the Solaris
      software.

      The Upgrade option updates the Solaris software to the new release, saving
      as many modifications to the previous version of Solaris software as
      possible.  Back up the system before using the Upgrade option.

      The Initial option overwrites the system disks with the new version of
      Solaris software.  This option allows you to preserve any existing file
      systems.  Back up any modifications made to the previous version of Solaris
      software before starting the Initial option.

      After you select an option and complete the tasks that follow, a summary of
      your actions will be displayed.  If you want to install the system with a
    --------------------------------------------------------------------------------
    - Solaris Interactive Installation ---------------------------------------------

      You'll be using the initial option for installing Solaris software on the
      system. The initial option overwrites the system disks when the new Solaris
      software is installed.

      On the following screens, you can accept the defaults or you can customize
      how Solaris software will be installed by:

            - Selecting the type of Solaris software to install
            - Selecting disks to hold software you've selected
            - Specifying how file systems are laid out on the disks

      After completing these tasks, a summary of your selections (called a
      profile) will be displayed.

      There are two ways to install your Solaris software:

       - "Standard" installs your system from a standard Solaris Distribution.
       - "Flash" installs your system from one or more Flash Archives.


    --------------------------------------------------------------------------------
      Loading install media, please wait...
    --------------------------------------------------------------------------------

    --------------------------------------------------------------------------------
    - Select Geographic Regions ----------------------------------------------------

      Select the geographic regions for which support should be installed.

      > [ ] Australasia
      > [ ] Central America
      > [ ] Northern Africa
      > [ ] Middle East
      > [ ] Western Europe
      > [ ] Central Europe
      > [ ] Southern Europe
      > [ ] North America
      > [ ] Asia
      > [ ] Northern Europe
      > [ ] Eastern Europe
       Press Return to show components
       Move left, right, up, down using the arrow keys
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
      > [ ] Australasia
      > [ ] Central America
      > [ ] Northern Africa
      > [ ] Middle East
      > [ ] Western Europe
      > [ ] Central Europe
      > [ ] Southern Europe
      > [ ] North America
      V [ ] Australasia
        [ ]     Australia (ISO8859-1)
        [ ]     New Zealand (ISO8859-1)
      > [ ] Central America
      > [ ] Northern Africa
      > [ ] Middle East
      > [ ] Western Europe
      > [ ] Central Europe
      > [ ] Southern Europe
      > [ ] North America
      > [ ] Asia
      > [ ] Northern Europe
      > [ ] Eastern Europe
      > [ ] South America

     

       Press Return to hide components
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
      V [ ] Australasia
        [ ]     Australia (ISO8859-1)
        [ ]     New Zealand (ISO8859-1)
      V [ ] Central America
        [ ]     Costa Rica (ISO8859-1)
        [ ]     El Salvador (ISO8859-1)
        [ ]     Guatemala (ISO8859-1)
        [ ]     Nicaragua (ISO8859-1)
        [ ]     Panama (ISO8859-1)
        [ ]     Spanish
      > [ ] Northern Africa
      > [ ] Middle East
      > [ ] Western Europe
      > [ ] Central Europe
      > [ ] Southern Europe
      > [ ] North America

       Press Return to hide components
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
      V [ ] Central America
        [ ]     Costa Rica (ISO8859-1)
        [ ]     El Salvador (ISO8859-1)
        [ ]     Guatemala (ISO8859-1)
        [ ]     Nicaragua (ISO8859-1)
        [ ]     Panama (ISO8859-1)
        [ ]     Spanish
      > [ ] Northern Africa
      > [ ] Middle East
      > [ ] Western Europe
      > [ ] Central Europe
      > [ ] Southern Europe
      V [ ] North America

       Press Return to hide components
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
        [ ]     Australia (ISO8859-1)
        [ ]     New Zealand (ISO8859-1)
      V [ ] Central America
        [ ]     Costa Rica (ISO8859-1)
        [ ]     El Salvador (ISO8859-1)
        [ ]     Guatemala (ISO8859-1)
        [ ]     Nicaragua (ISO8859-1)
        [ ]     Panama (ISO8859-1)
        [ ]     Spanish
      > [ ] Northern Africa
      > [ ] Middle East
      > [ ] Western Europe
      > [ ] Central Europe
      > [ ] Southern Europe
      V [ ] North America
        [ ]     Canada-English (ISO8859-1)


    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
        [ ]     New Zealand (ISO8859-1)
      V [ ] Central America
        [ ]     Costa Rica (ISO8859-1)
        [ ]     El Salvador (ISO8859-1)
        [ ]     Guatemala (ISO8859-1)
        [ ]     Nicaragua (ISO8859-1)
        [ ]     Panama (ISO8859-1)
        [ ]     Spanish
      > [ ] Northern Africa
      > [ ] Middle East
      > [ ] Western Europe
      > [ ] Central Europe
      > [ ] Southern Europe
      V [ ] North America
        [ ]     Canada-English (ISO8859-1)
        [ ]     Canada-French (ISO8859-1)


    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
      V [ ] Central America
        [ ]     Costa Rica (ISO8859-1)
        [ ]     El Salvador (ISO8859-1)
        [ ]     Guatemala (ISO8859-1)
        [ ]     Nicaragua (ISO8859-1)
        [ ]     Panama (ISO8859-1)
        [ ]     Spanish
      > [ ] Northern Africa
      > [ ] Middle East
      > [ ] Western Europe
      > [ ] Central Europe
      > [ ] Southern Europe
      V [ ] North America
        [ ]     Canada-English (ISO8859-1)
        [ ]     Canada-French (ISO8859-1)
        [ ]     French


    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
        [ ]     Costa Rica (ISO8859-1)
        [ ]     El Salvador (ISO8859-1)
        [ ]     Guatemala (ISO8859-1)
        [ ]     Nicaragua (ISO8859-1)
        [ ]     Panama (ISO8859-1)
        [ ]     Spanish
      > [ ] Northern Africa
      > [ ] Middle East
      > [ ] Western Europe
      > [ ] Central Europe
      > [ ] Southern Europe
      V [ ] North America
        [ ]     Canada-English (ISO8859-1)
        [ ]     Canada-French (ISO8859-1)
        [ ]     French
        [ ]     Mexico (ISO8859-1)


    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
        [ ]     El Salvador (ISO8859-1)
        [ ]     Guatemala (ISO8859-1)
        [ ]     Nicaragua (ISO8859-1)
        [ ]     Panama (ISO8859-1)
        [ ]     Spanish
      > [ ] Northern Africa
      > [ ] Middle East
      > [ ] Western Europe
      > [ ] Central Europe
      > [ ] Southern Europe
      V [ ] North America
        [ ]     Canada-English (ISO8859-1)
        [ ]     Canada-French (ISO8859-1)
        [ ]     French
        [ ]     Mexico (ISO8859-1)
        [ ]     Spanish


    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
        [ ]     Guatemala (ISO8859-1)
        [ ]     Nicaragua (ISO8859-1)
        [ ]     Panama (ISO8859-1)
        [ ]     Spanish
      > [ ] Northern Africa
      > [ ] Middle East
      > [ ] Western Europe
      > [ ] Central Europe
      > [ ] Southern Europe
      V [ ] North America
        [ ]     Canada-English (ISO8859-1)
        [ ]     Canada-French (ISO8859-1)
        [ ]     French
        [ ]     Mexico (ISO8859-1)
        [ ]     Spanish
        [ ]     U.S.A. (UTF-8)


    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
        [ ]     Nicaragua (ISO8859-1)
        [ ]     Panama (ISO8859-1)
        [ ]     Spanish
      > [ ] Northern Africa
      > [ ] Middle East
      > [ ] Western Europe
      > [ ] Central Europe
      > [ ] Southern Europe
      V [ ] North America
        [ ]     Canada-English (ISO8859-1)
        [ ]     Canada-French (ISO8859-1)
        [ ]     French
        [ ]     Mexico (ISO8859-1)
        [ ]     Spanish
        [ ]     U.S.A. (UTF-8)
        [ ]     U.S.A. (en_US.ISO8859-1)


    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
        [ ]     U.S.A. (UTF-8)
        [ ]     U.S.A. (UTF-8)
        [ ]     U.S.A. (en_US.ISO8859-1)

        [ ]     Panama (ISO8859-1)
        [ ]     Spanish
      > [ ] Northern Africa
      > [ ] Middle East
      > [ ] Western Europe
      > [ ] Central Europe
      > [ ] Southern Europe
      V [ ] North America
        [ ]     Canada-English (ISO8859-1)
        [ ]     Canada-French (ISO8859-1)
        [ ]     French
        [ ]     Mexico (ISO8859-1)
        [ ]     Spanish
        [ ]     U.S.A. (UTF-8)
        [ ]     U.S.A. (en_US.ISO8859-1)
      > [ ] Asia

       Region is deselected.  Press Return to select
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
      > [ ] Asia

        [ ]     U.S.A. (UTF-8)
        [ ]     U.S.A. (en_US.ISO8859-1)
        [ ]     Spanish
      > [ ] Northern Africa
      > [ ] Middle East
      > [ ] Western Europe
      > [ ] Central Europe
      > [ ] Southern Europe
      V [ ] North America
        [ ]     Canada-English (ISO8859-1)
        [ ]     Canada-French (ISO8859-1)
        [ ]     French
        [ ]     Mexico (ISO8859-1)
        [ ]     Spanish
        [ ]     U.S.A. (UTF-8)
        [ ]     U.S.A. (en_US.ISO8859-1)
      > [ ] Asia
      > [ ] Northern Europe

       Region is deselected.  Press Return to select
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
      > [ ] Northern Africa
      > [ ] Middle East
      > [ ] Western Europe
      > [ ] Central Europe
      > [ ] Southern Europe
      V [ ] North America
        [ ]     Canada-English (ISO8859-1)
        [ ]     Canada-French (ISO8859-1)
        [ ]     French
        [ ]     Mexico (ISO8859-1)
        [ ]     Spanish
        [ ]     U.S.A. (UTF-8)
        [ ]     U.S.A. (en_US.ISO8859-1)
      > [ ] Asia
      > [ ] Northern Europe
      > [ ] Eastern Europe

       Region is deselected.  Press Return to select
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
      V [/] North America
       Locale is selected.  Press Return to deselect
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
        [X]     Canada-English (ISO8859-1)
        [ ]     Canada-French (ISO8859-1)
        [ ]     French
        [ ]     Mexico (ISO8859-1)
        [ ]     Spanish
       Locale is selected.  Press Return to deselect
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
        [X]     U.S.A. (UTF-8)
       Locale is selected.  Press Return to deselect
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
        [X]     U.S.A. (en_US.ISO8859-1)
       Region is selected.  Press Return to deselect
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
      > [X] Asia
      > [ ] Northern Europe
      V [X] Asia
        [X]     Hindi UTF-8
        [X]     Japanese EUC (ja)

       Press Return to hide components
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
      V [X] Asia
      V [/] Asia
       Locale is deselected.  Press Return to select
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
        [ ]     Hindi UTF-8
      > [ ] Middle East
      > [ ] Western Europe
      > [ ] Central Europe
      > [ ] Southern Europe
      V [/] North America
        [X]     Canada-English (ISO8859-1)
        [ ]     Canada-French (ISO8859-1)
        [ ]     French
        [ ]     Mexico (ISO8859-1)
        [ ]     Spanish
        [X]     U.S.A. (UTF-8)
        [X]     U.S.A. (en_US.ISO8859-1)
      V [/] Asia
        [ ]     Hindi UTF-8
        [X]     Japanese EUC (ja)
        [X]     Japanese PC Kanji (ja_JP.PCK)

       Locale is selected.  Press Return to deselect
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
      > [ ] Western Europe
      > [ ] Central Europe
      > [ ] Southern Europe
      V [/] North America
        [X]     Canada-English (ISO8859-1)
        [ ]     Canada-French (ISO8859-1)
        [ ]     French
        [ ]     Mexico (ISO8859-1)
        [ ]     Spanish
        [X]     U.S.A. (UTF-8)
        [X]     U.S.A. (en_US.ISO8859-1)
      V [/] Asia
        [ ]     Hindi UTF-8
        [X]     Japanese EUC (ja)
        [X]     Japanese PC Kanji (ja_JP.PCK)
        [X]     Japanese UTF-8 (ja_JP.UTF-8)

       Locale is selected.  Press Return to deselect
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
      > [ ] Central Europe
      > [ ] Southern Europe
      V [/] North America
        [X]     Canada-English (ISO8859-1)
        [ ]     Canada-French (ISO8859-1)
        [ ]     French
        [ ]     Mexico (ISO8859-1)
        [ ]     Spanish
        [X]     U.S.A. (UTF-8)
        [X]     U.S.A. (en_US.ISO8859-1)
      V [/] Asia
        [ ]     Hindi UTF-8
        [X]     Japanese EUC (ja)
        [X]     Japanese PC Kanji (ja_JP.PCK)
        [X]     Japanese UTF-8 (ja_JP.UTF-8)
        [X]     Korean EUC

       Locale is selected.  Press Return to deselect
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
       Locale is deselected.  Press Return to select
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
        [ ]     Japanese EUC (ja)
       Locale is deselected.  Press Return to select
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
        [ ]     Japanese PC Kanji (ja_JP.PCK)
       Locale is deselected.  Press Return to select
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
        [ ]     Japanese UTF-8 (ja_JP.UTF-8)
        [ ]     Korean EUC

       Locale is deselected.  Press Return to select
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
      > [ ] Southern Europe
      V [/] North America
        [X]     Canada-English (ISO8859-1)
        [ ]     Canada-French (ISO8859-1)
        [ ]     French
        [ ]     Mexico (ISO8859-1)
        [ ]     Spanish
        [X]     U.S.A. (UTF-8)
        [X]     U.S.A. (en_US.ISO8859-1)
      V [/] Asia
        [ ]     Hindi UTF-8
        [ ]     Japanese EUC (ja)
        [ ]     Japanese PC Kanji (ja_JP.PCK)
        [ ]     Japanese UTF-8 (ja_JP.UTF-8)
        [ ]     Korean EUC
        [X]     Korean UTF-8

       Locale is selected.  Press Return to deselect
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
        [ ]     Korean UTF-8

       Locale is deselected.  Press Return to select
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
      V [/] North America
        [X]     Canada-English (ISO8859-1)
        [ ]     Canada-French (ISO8859-1)
        [ ]     French
        [ ]     Mexico (ISO8859-1)
        [ ]     Spanish
        [X]     U.S.A. (UTF-8)
        [X]     U.S.A. (en_US.ISO8859-1)
      V [/] Asia
        [ ]     Hindi UTF-8
        [ ]     Japanese EUC (ja)
        [ ]     Japanese PC Kanji (ja_JP.PCK)
        [ ]     Japanese UTF-8 (ja_JP.UTF-8)
        [ ]     Korean EUC
        [ ]     Korean UTF-8
        [X]     Simplified Chinese EUC

       Locale is selected.  Press Return to deselect
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
        [X]     Canada-English (ISO8859-1)
        [ ]     Canada-French (ISO8859-1)
        [ ]     French
        [ ]     Mexico (ISO8859-1)
        [ ]     Spanish
        [X]     U.S.A. (UTF-8)
        [X]     U.S.A. (en_US.ISO8859-1)
      V [/] Asia
        [ ]     Hindi UTF-8
        [ ]     Japanese EUC (ja)
        [ ]     Japanese PC Kanji (ja_JP.PCK)
        [ ]     Japanese UTF-8 (ja_JP.UTF-8)
        [ ]     Korean EUC
        [ ]     Korean UTF-8
        [X]     Simplified Chinese EUC
        [X]     Simplified Chinese GB18030

       Locale is selected.  Press Return to deselect
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
        [ ]     Canada-French (ISO8859-1)
        [ ]     French
        [ ]     Mexico (ISO8859-1)
        [ ]     Spanish
        [X]     U.S.A. (UTF-8)
        [X]     U.S.A. (en_US.ISO8859-1)
      V [/] Asia
        [ ]     Hindi UTF-8
        [ ]     Japanese EUC (ja)
        [ ]     Japanese PC Kanji (ja_JP.PCK)
        [ ]     Japanese UTF-8 (ja_JP.UTF-8)
        [ ]     Korean EUC
        [ ]     Korean UTF-8
        [X]     Simplified Chinese EUC
        [X]     Simplified Chinese GB18030
        [X]     Simplified Chinese GBK

       Locale is selected.  Press Return to deselect
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
        [ ]     French
        [ ]     Mexico (ISO8859-1)
        [ ]     Spanish
        [X]     U.S.A. (UTF-8)
        [X]     U.S.A. (en_US.ISO8859-1)
      V [/] Asia
        [ ]     Hindi UTF-8
        [ ]     Japanese EUC (ja)
        [ ]     Japanese PC Kanji (ja_JP.PCK)
        [ ]     Japanese UTF-8 (ja_JP.UTF-8)
        [ ]     Korean EUC
        [ ]     Korean UTF-8
        [X]     Simplified Chinese EUC
        [X]     Simplified Chinese GB18030
        [X]     Simplified Chinese GBK
        [X]     Simplified Chinese UTF-8

       Locale is selected.  Press Return to deselect
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
        [ ]     Mexico (ISO8859-1)
        [ ]     Spanish
        [X]     U.S.A. (UTF-8)
        [X]     U.S.A. (en_US.ISO8859-1)
      V [/] Asia
        [ ]     Hindi UTF-8
        [ ]     Japanese EUC (ja)
        [ ]     Japanese PC Kanji (ja_JP.PCK)
        [ ]     Japanese UTF-8 (ja_JP.UTF-8)
        [ ]     Korean EUC
        [ ]     Korean UTF-8
        [X]     Simplified Chinese EUC
        [X]     Simplified Chinese GB18030
        [X]     Simplified Chinese GBK
        [X]     Simplified Chinese UTF-8
        [X]     Thai TIS620

       Locale is selected.  Press Return to deselect
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
        [ ]     Spanish
        [X]     U.S.A. (UTF-8)
        [X]     U.S.A. (en_US.ISO8859-1)
      V [/] Asia
        [ ]     Hindi UTF-8
        [ ]     Japanese EUC (ja)
        [ ]     Japanese PC Kanji (ja_JP.PCK)
        [ ]     Japanese UTF-8 (ja_JP.UTF-8)
        [ ]     Korean EUC
        [ ]     Korean UTF-8
        [X]     Simplified Chinese EUC
        [X]     Simplified Chinese GB18030
        [X]     Simplified Chinese GBK
        [X]     Simplified Chinese UTF-8
        [X]     Thai TIS620
        [X]     Thai UTF-8

       Locale is selected.  Press Return to deselect
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
       Locale is deselected.  Press Return to select
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
        [ ]     Thai TIS620
        [ ]     Thai UTF-8

       Locale is deselected.  Press Return to select
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
        [X]     U.S.A. (UTF-8)
        [X]     U.S.A. (en_US.ISO8859-1)
      V [/] Asia
        [ ]     Hindi UTF-8
        [ ]     Japanese EUC (ja)
        [ ]     Japanese PC Kanji (ja_JP.PCK)
        [ ]     Japanese UTF-8 (ja_JP.UTF-8)
        [ ]     Korean EUC
        [ ]     Korean UTF-8
        [X]     Simplified Chinese EUC
        [X]     Simplified Chinese GB18030
        [X]     Simplified Chinese GBK
        [X]     Simplified Chinese UTF-8
        [ ]     Thai TIS620
        [ ]     Thai UTF-8
        [X]     Traditional Chinese (Hong Kong) BIG5+HKSCS

       Locale is selected.  Press Return to deselect
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
        [X]     U.S.A. (en_US.ISO8859-1)
      V [/] Asia
        [ ]     Hindi UTF-8
        [ ]     Japanese EUC (ja)
        [ ]     Japanese PC Kanji (ja_JP.PCK)
        [ ]     Japanese UTF-8 (ja_JP.UTF-8)
        [ ]     Korean EUC
        [ ]     Korean UTF-8
        [X]     Simplified Chinese EUC
        [X]     Simplified Chinese GB18030
        [X]     Simplified Chinese GBK
        [X]     Simplified Chinese UTF-8
        [ ]     Thai TIS620
        [ ]     Thai UTF-8
        [X]     Traditional Chinese (Hong Kong) BIG5+HKSCS
        [X]     Traditional Chinese (Hong Kong) UTF-8

       Locale is selected.  Press Return to deselect
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
      V [/] Asia
        [ ]     Hindi UTF-8
        [ ]     Japanese EUC (ja)
        [ ]     Japanese PC Kanji (ja_JP.PCK)
        [ ]     Japanese UTF-8 (ja_JP.UTF-8)
        [ ]     Korean EUC
        [ ]     Korean UTF-8
        [X]     Simplified Chinese EUC
        [X]     Simplified Chinese GB18030
        [X]     Simplified Chinese GBK
        [X]     Simplified Chinese UTF-8
        [ ]     Thai TIS620
        [ ]     Thai UTF-8
        [X]     Traditional Chinese (Hong Kong) BIG5+HKSCS
        [X]     Traditional Chinese (Hong Kong) UTF-8
        [X]     Traditional Chinese BIG5

       Locale is selected.  Press Return to deselect
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
        [ ]     Hindi UTF-8
        [ ]     Japanese EUC (ja)
        [ ]     Japanese PC Kanji (ja_JP.PCK)
        [ ]     Japanese UTF-8 (ja_JP.UTF-8)
        [ ]     Korean EUC
        [ ]     Korean UTF-8
        [X]     Simplified Chinese EUC
        [X]     Simplified Chinese GB18030
        [X]     Simplified Chinese GBK
        [X]     Simplified Chinese UTF-8
        [ ]     Thai TIS620
        [ ]     Thai UTF-8
        [X]     Traditional Chinese (Hong Kong) BIG5+HKSCS
        [X]     Traditional Chinese (Hong Kong) UTF-8
        [X]     Traditional Chinese BIG5
        [X]     Traditional Chinese EUC

       Locale is selected.  Press Return to deselect
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
        [ ]     Japanese EUC (ja)
        [ ]     Japanese PC Kanji (ja_JP.PCK)
        [ ]     Japanese UTF-8 (ja_JP.UTF-8)
        [ ]     Korean EUC
        [ ]     Korean UTF-8
        [X]     Simplified Chinese EUC
        [X]     Simplified Chinese GB18030
        [X]     Simplified Chinese GBK
        [X]     Simplified Chinese UTF-8
        [ ]     Thai TIS620
        [ ]     Thai UTF-8
        [X]     Traditional Chinese (Hong Kong) BIG5+HKSCS
        [X]     Traditional Chinese (Hong Kong) UTF-8
        [X]     Traditional Chinese BIG5
        [X]     Traditional Chinese EUC
        [X]     Traditional Chinese UTF-8

       Locale is selected.  Press Return to deselect
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
        [ ]     Japanese PC Kanji (ja_JP.PCK)
        [ ]     Japanese UTF-8 (ja_JP.UTF-8)
        [ ]     Korean EUC
        [ ]     Korean UTF-8
        [X]     Simplified Chinese EUC
        [X]     Simplified Chinese GB18030
        [X]     Simplified Chinese GBK
        [X]     Simplified Chinese UTF-8
        [ ]     Thai TIS620
        [ ]     Thai UTF-8
        [X]     Traditional Chinese (Hong Kong) BIG5+HKSCS
        [X]     Traditional Chinese (Hong Kong) UTF-8
        [X]     Traditional Chinese BIG5
        [X]     Traditional Chinese EUC
        [X]     Traditional Chinese UTF-8
      > [ ] Northern Europe

       Region is deselected.  Press Return to select
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
      > [ ] Northern Europe

       Region is deselected.  Press Return to select
    -----Esc-2_Continue    Esc-3_Go Back    Esc-5_Exit    Esc-6_Help----------------
    - Select Software --------------------------------------------------------------

      Select the Solaris software to install on the system.

      NOTE: After selecting a software group, you can add or remove software by
      customizing it. However, this requires understanding of software
      dependencies and how Solaris software is packaged. The software groups
      displaying 64-bit contain 64-bit support.

          [ ]  Entire Distribution plus OEM support 64-bit  3296.00 MB
          [X]  Entire Distribution 64-bit ................. 3252.00 MB
          [ ]  Developer System Support 64-bit ............ 2690.00 MB
          [ ]  End User System Support 64-bit ............. 2140.00 MB
    --------------------------------------------------------------------------------
          [X]  Entire Distribution 64-bit ................. 3252.00 MB
          [ ]  Entire Distribution 64-bit ................. 3252.00 MB
          [ ]  Entire Distribution 64-bit ................. 3252.00 MB
          [ ]  Entire Distribution plus OEM support 64-bit  3296.00 MB
          [X]  Entire Distribution plus OEM support 64-bit  3296.00 MB
          [ ]  Entire Distribution 64-bit ................. 3252.00 MB
       Please wait ...
    --------------------------------------------------------------------------------
    - Select Disks -----------------------------------------------------------------

      On this screen you must select the disks for installing Solaris software.
      Start by looking at the Suggested Minimum field; this value is the
      approximate space needed to install the software you've selected. Keep
      selecting disks until the Total Selected value exceeds the S

  • Installation for oracle 10g

    2008-11-12 15:58:49

    Installation for oracle 10g

    Oracle 10g (10.2.0.1) and patch set (10.2.0.3) CD package:

    O:\proj\shanghai\1150\software\EMS\Oracle10g

    Preinstallation tasks

    1.       Run ‘gzip -d 10gr2_db_sol.cpio.gz’ to decompress oracle 10g.

    2.       Run ‘cpio -idmv < 10gr2_db_sol.cpio’ to decompress oracle 10g.

    3.       Run ‘gzip -d ems.7.0.0.0.0.tar.Z’ and ‘tar –xvf ems.7.0.0.0.0.tar’ to decompress Panorama

    4.       Run ‘./uninstall.sh manager’ to uninstall Panorama and Oracle. When it asks if you want to uninstall Oracle, say ‘yes’.

    5.       After running ‘./setup.sh’, ‘cd /usr/afcems_install’ and edit the file installOracleConfigEMS.rsp to make sure all values match your server; i.e. the number of Oracle mount points to be configured is correct, the location of the mount points is correct, the Oracle version to be installed is Oracle 10 (it defaults to 9i), Oracle source location also defaults to Oracle 9i, so change it to where your Oracle 10 files can be found, etc. 

           TIP – you can only save your changes with ‘:w!’.

    Silent installation for oracle 10g

    1.         Configure your DISPLAY variable to be your PC IP address (in bash: DISPLAY=192.168.xxx.xxx:0.0;export DISPLAY)( run /usr/openwin/bin/xclock to make sure it is set correctly )

    2.         Now run ‘./installOracleConfigEMS –f installOracleConfigEMS.rsp’ which will silently install Oracle 10.  It may ask you to reboot the server (‘/etc/shutdown –y –g0 –i6’) if the /etc/system file has been changed, and you must run the above executable again.

    Installation oracle 10g patch set

    Preinstallation tasks

    1.         Complete silent installation for oracle 10g.

    2.         Run ‘/etc/init.d/dbora stop’ to stop all processes

    If the scrīpt doesn’t work, you have to manually stop all processes, listeners and database instances in the Oracle home directory, where you need to install the patch set.

    3.         Run ‘unzip patch5337014_10203_SOLARIS64.zip’ to decompress patch set.

    Interactive installation for oracle 10g patch set

    1.         Login in as the oracle user.

    2.         Configure your DISPLAY variable to be your PC IP address (in bash: DISPLAY=192.168.xxx.xxx:0.0;export DISPLAY)( run /usr/openwin/bin/xclock to make sure it is set correctly )

    3.         Run ‘cd patchset_directory/Disk1’.

    4.         Run ‘./runInstaller’.

    5.         On the Welcome screen, click Next.

    6.         In the Specify Home Details screen, select the name of the Oracle home that you want to update, or select the Path that you want to update from the list, then click Next.

    7.         On the Summary screen, click Install. (This screen lists all of the patches available for installation.)

    8.         When prompted, run the ‘$ORACLE_HOME/root.sh’ scrīpt as the root user.

    9.         On the End of Installation screen, click Exit, then click Yes to exit from Oracle Universal Installer.

    Postinstallation tasks

    Upgrading a Release 10.2 Database using Oracle Database Upgrade Assistant

    After you install the patch set, you must perform the following steps on every database associated with the upgraded Oracle home:

    1.         $ dbua

    2.         On the Welcome screen, click Next.

    3.         On the Databases screen, select the name of the Oracle Database that you want to update, then click Next.

    4.         On the Recompile invalid objects screen, select the Recompile the invalid objects at the end of upgrade option, then click Next.

    5.         If you have not taken the back up of the database earlier, on the Backup screen, select the I would like to take this tool to backup the database option, mentions the Path, and then click Next.

    6.         On the Summary screen, check the summary, then click Finish.

    7.         On the End of upgradation screen, click Exit, then click Yes to exit from Oracle Database Upgrade Assistant.

    Troubleshooting:

    behavīor:

    After completing installation for oracle 10g, startup oracle database throws the following errors:

    ORA-01092: ORACLE instance terminated. Disconnection forced

    ORA-39700: database must be opened with UPGRADE option.

    Solution:

    You must finish the postinstallation tasks.

    TIP:

    1.         Path for installation oracle error log: $ORACLE_BASE/admin/EMS/bdump/alert_EMS.log

    2.         Type ‘SQL> !oerr ora 39700‘ in sqlplus to get more details:

    SQL>!oerr ora 39700

    39700, 00000, "database must be opened with UPGRADE option"

    // *Cause:  A normal database open was attempted, but the database has not

    //          been upgraded to the current server version.

    // *Action: Use the UPGRADE option when opening the database to run

    //          catupgrd.sql (for database upgrade), or to run catalog.sql

    //          and catproc.sql (after initial database creation).

     

  • restart oracle

    2008-11-12 15:55:52

     

    启动/关闭监听:

    Su – oracle

    $ lsnrctl start                #启动监听

    $ lsnrctl stop                 #关闭监听

    $ lsnrctl status        #查看监听状态

     

    启动/关闭数据库:

    Su – oracle

    $ sqlplus /nolog

    SQL> conn / as sysdba

    SQL> shutdown       #关闭数据库
    SQL> startup                #
    启动数据库

    SQL> show parameters inst

    SQL> exit

    $ ps -ef | grep oracle

  • crontab -- solaris 定时运行脚本命令

    2008-11-12 15:49:16

    -bash-3.00# crontab -l # view crontab file
    -bash-3.00# crontab -e # edit crontab file

    #use the following way to edit crontab file
    -bash-3.00# crontab -l > newcron

    # edit crontab file
    -bash-3.00# vi newcron
    #add lines...

    -bash-3.00# crontab newcron

  • 算用户名和密码

    2008-11-12 15:42:17

    Sub Macro1()
    '
    ' Macro1 Macro

    ActiveSheet.Range("C4") = ""
    ActiveSheet.Range("C5") = ""

    Dim str As String
    str = ActiveSheet.Range("C3").Value
    str = Format(str, "d/m/yy h:mm:ss")
    If IsDate(str) = False Then
        MsgBox ("Please enter an date expression like 'd/m/yy h:mm:ss' in C3.")
        Exit Sub
    End If
    splitStr = Split(str, " ")
    myDate = splitStr(0)
    myTime = splitStr(1)

    arrTime = getArr(myTime, ":")
    myUB = UBound(arrTime)
    For j = 0 To myUB
        sumTime = sumTime + arrTime(j)
    Next j
    userName = "0x" & sumTime
    'Debug.Print userName
    ActiveSheet.Range("C4") = userName

    arrDate = getArr(myDate, "/")
    myUB = UBound(arrDate)
    For k = 0 To myUB - 1
        sumDate = arrDate(k) * arrDate(k + 1)
        dateStr = dateStr & sumDate
    Next k
    password = "0x" & dateStr
    'Debug.Print password
    ActiveSheet.Range("C5") = password

    End Sub

    Function getX(ByVal x)
        getX = x \ 10
    End Function

    Function getY(ByVal y)
        getY = y Mod 10
    End Function

    Function getArr(ByVal strVal, ByVal delimiter)
        splitString = Split(strVal, delimiter)
        myUB = UBound(splitString)
        Dim arrayStr() As Integer
        num = 0
        For i = 0 To myUB
            MyStr = splitString(i)
            If getX(MyStr) <> 0 Then
                ReDim Preserve arrayStr(num)
                arrayStr(num) = getX(MyStr)
                num = num + 1
            End If
            ReDim Preserve arrayStr(num)
            arrayStr(num) = getY(MyStr)
            num = num + 1
        Next i
        getArr = arrayStr
    End Function

  • 相关配置文件

    2008-11-12 15:07:14

    1、emsversion.ini
    8.0.0.0.15

    2、env.ini
    #############################################################################
    #
    # This is a response file for silent installation of Panorama INM.
    #
    ###############################################################################
    #
    # Responses are in the form of
    # NAME="value"
    # Please do not change the Attribute names. You should only change the values
    # for these attributes i.e. the portion inside the ""
    #
    # Please do not remove or add any line in this file.
    #
    # Lines beginning with # is treated as comments.
    #
    ###############################################################################

    # EMSVERSION will be replace to actual string from emsversion.ini

    # The directory which contains ZFILE.
    EMSDIR="/ems/Panorama_VEMSVERSION/cdrom"

    # The directory which contains patchJars.
    PATCHDIR="/ems/Panorama_VEMSVERSION/patchJars"

    # Installation Z file
    ZFILE="ems.EMSVERSION.tar.Z"

    # EMS machine's ip address
    HOSTNAME="192.168.120.201"

    USERNAME="cnshroot"

    PASSWD="shroot"

    ##PROMPT="-bash-3.00#"

    # Installation direcotry which contains installation files.
    AFCDIR="/usr/afcems_install"

    SETUPFILE="setup.sh"

    YOURPCIPADDRESS="192.168.127.145"

    # yes / no # set whether reboot solaris after installation
    REBOOT="yes"

    # ANSI / ETSI # Modify it in install.ini file if need.
    ##EMSTYPE="ANSI"

    # sql "system" user password # Modify it in uninstall.ini file if need.
    ##ORASYSPWD="manager"

    3、uninstall.ini
    ./uninstall.sh
    You are un-installing INM server which requires Oracle System User Password, Please Enter  :
    manager
    Do you wish to continue
    y
    Do you wish to remove oracle
    n
    Uninstall complete

    4、install.ini
    ./install.sh
    Browser choice:
    2
    Enter the directory where Mozilla version
    /usr/sfw/lib/mozilla
    Are you installing the Panorama client only
    n
    Please press the return key to continue.
    enter
    Use the industry standard UDP Port 162 to receive SNMP traps
    y
    Do you wish to manage AccessMAX systems
    y
    Do you wish to manage Telliant systems
    n
    Do you wish to manage Harmonic EDFA or transmitter equipment
    n
    Do you wish to manage Scientific Atlanta PRISMA equipment
    n
    Do you wish to manage Tellabs 1100 equipment
    y
    Do you wish to use default userid
    y
    Please enter Oracle Server IP Address or Hostname Press Enter for default
    sunshapp24
    How many managed units
    20
    Where should the Panorama package be installed
    /opt/afc
    What type of AccessMax systems are primarily being
    ANSI
    Use the OS login information for Panorama authorization
    n
    Is this correct
    y
    Do you agree to the above license terms
    yes
    Please enter the path for the directory where Orbix is installed
    /opt/iona63
    Please enter the path for Orbix configuration directory
    /etc/opt/iona63
    Would you like to install the SNMP agent
    y
    Passwd:
    adm1n
    Confirm Passwd:
    adm1n
    Do you wish to install the TL1 Northbound Interface package
    y
    Do you wish to modify these settings
    n
    Do you wish to install the BURG Report Generator package
    n
    Do you have a Tellabs 1000 Upgrade Program CD that you wish to install
    n
    Do you wish to use the enhanced Auto Naming functionality
    n
    Panorama installation complete

  • email.pl

    2008-11-12 15:01:55

    use Net::SMTP;

    my $smtpSer = 'mailhost';
    my $from = 'from@xxx.com';
    my $to = 'to@xxx.com';
    my $subject = 'Daily check the Pan INM release @'.`date /T`;
    my $body = "";
    open FILE, "< checkRelease.log"
         or die "Can't open the file: checkRelease.log! ($!)";
    while (<FILE>) {
     $body = "$body$_";
    }
    close FILE;

    $smtp = Net::SMTP->new($smtpSer);

    $smtp->mail($ENV{USER});
    $smtp->to($to);

    $smtp->data();
    $smtp->datasend("From: $from\n");
    $smtp->datasend("To: $to\n");
    $smtp->datasend("Subject: $subject\n");
    $smtp->datasend("$body\n-Yourname");
    $smtp->dataend();

    $smtp->quit;

  • interactivelyInstallPanINM.pl

    2008-11-12 15:01:05

    use Net::Telnet ();

    $emsVersion = readEmsVersion("emsversion.ini");

    #$prompt = "PROMPT";
    $hostname = "HOSTNAME";
    $username = "USERNAME";
    $passwd = "PASSWD";
    $emsDir = "EMSDIR";
    $patchDir = "PATCHDIR";
    $afcDir = "AFCDIR";
    $zFile = "ZFILE";
    $setupFile = "SETUPFILE";
    $yourPCIPAddress = "YOURPCIPADDRESS";
    $reboot = "REBOOT";
    $envFile = "env.ini";
    $uninstallFile = "uninstall.ini";
    $installFile = "install.ini";
    $inputLog = 'installation.log';
    $outputLog = 'output.log';
    $dumpLog = 'dumplog.txt';
    $endOfFile = "Log_is_the_end_of_file";
    $doneInstall = 0;
    $doneUninstall = 0;

    ##Read environment value from env file.
    &readEnv;

    ##Create a telnet session
    $conn = &spawn($hostname, $username, $passwd, $prompt);

    ##You have to run this scrīpt as a root user.
    &isRoot;

    ##Configure your DISPLAY variable to be your PC IP address
    &display;

    ##Change directory to emsdir
    &cd($emsDir);

    ##unzip the *.Z file
    &tar;

    ##Kick emsadmin user
    &kickEmsadmin;

    ##Restart oracle. need fix prompt > issue
    &restartDB;

    ##Uninstall the previous Pan INM load.
    &uninstall;

    ##Quit if uninstallation didn't complete
    &quit unless $doneUninstall;

    ##Setup the installation files.
    &setup;

    ##Change directory to afcdir
    &cd($afcDir);

    #Kick emsadmin user
    &kickEmsadmin;

    ##Install Pan INM
    &install;

    ##Quit if installation didn't complete
    &quit unless $doneInstall;

    ##Install patches
    &installPatches;

    ##Reboot solaris
    &reboot;

    $conn->cmd($endOfFile);

    ##Close the session and exit this scrīpt
    &quit;

    sub readEnv {
     my ($name, $value, $num, @field);
     open FILE, $envFile
      or die "Can't open the file: $envFile! ($!)";
     while(<FILE>){
      chomp;
      # go to next while if a line in $envFile is an empty or its first char is #
      next if ($_ eq "" || /^#/);
      @field = split /=/, $_;
      # get the amount of @field's element
      $num = @field;
      die "The value should be inside the \"\", please check your $envFile file.\n" if ($num < 2);
      $value = pop @field;
      $name = pop @field;
      $name =~ s/^\s+|\s+$//g;
      $value =~ s/^"|"$|^\s+|\s+$//g;
      $value =~ s/EMSVERSION/$emsVersion/g;
      die "Find an empty attribute name, please check your $envFile file.\n" if ($name eq "");
      if ($name eq $hostname){
       $hostname = $value;
       print "$name is $value in env sub\n";
      }elsif ($name eq $username){
       $username = $value;
       print "$name is $value in env sub\n";
      }elsif ($name eq $passwd){
       $passwd = $value;
       print "$name is $value in env sub\n";
      }elsif ($name eq $emsDir){
       $emsDir = $value;
       print "$name is $value in env sub\n";
      }elsif ($name eq $patchDir){
       $patchDir = $value;
       print "$name is $value in env sub\n";
      }elsif ($name eq $afcDir){
       $afcDir = $value;
       print "$name is $value in env sub\n";
      }elsif ($name eq $emsVersion){
       $emsVersion = $value;
       print "$name is $value in env sub\n";
      }elsif ($name eq $zFile){
       $zFile = $value;
       print "$name is $value in env sub\n";
      }elsif ($name eq $setupFile){
       $setupFile = $value;
       print "$name is $value in env sub\n";
      }elsif ($name eq $yourPCIPAddress){
       $yourPCIPAddress = $value;
       print "$name is $value in env sub\n";
      }elsif ($name eq $reboot){
       $reboot = $value;
       print "$name is $value in env sub\n";
      }
    #  elsif ($name eq $prompt){
    #   $prompt = $value;
    #   #print "$name is $value in env sub\n";
    #  }
      else{
       die "Can't find the attribute name: $name, please check your $envFile file.\n"
      }
      ## next will goto here
     }
     close FILE;
    } # end sub readEnv

    sub readFromFile {
     my ($filename) = @_;
     my @arrays;
     open FILE, $filename
      or die "Can't open the file: $filename! ($!)";
     while(<FILE>){
      chomp;
      if ($_ ne ""){
       push @arrays, $_;
      }
     }
     close FILE;
     @arrays;
    } # readFromFile

    sub spawn {
     $t = new Net::Telnet (Timeout => 3,);
                #Prompt => '/'.$prompt.' $/');
     $t->max_buffer_length(10_485_760);# 10M
     #all of input,output will be written in the file           
     $t->input_log($inputLog);
     
     

     $t->dump_log($dumpLog);
     $t->output_log($outputLog);
     $t->open($hostname);
     my $ok = $t->login($username, $passwd);
     $t; 
    } # end sub spawn

    sub fileExist {
     my ($filename) = @_;
     my $cmdStr = 'ls "'. $filename .'"';
     $conn->cmd($cmdStr);
      chomp (my $line = $conn->lastline);
      my $match = $filename . ': No such file or directory';
      if ($line =~ /$match/){
       return 0; 
      }
     1;
    } # end sub fileExist

    sub isRoot {
     my $cmdStr = "/usr/ucb/whoami";
     $conn->cmd($cmdStr);
     chomp (my $line = $conn->lastline);
      my $match = "root";
      if ($line ne $match){
       die "You must be root to execute this scrīpt. Please modify $envFile file"; 
      }
    } # end sub isRoot

    sub cd {
     my ($dir) = @_;
     if (&fileExist($dir)){
      my $cmdStr = "cd ". $dir;
      $conn->cmd($cmdStr);
     }else{
      die "$dir: No such file or directory";
     } 
    } # end sub cd

    sub tar {
     if (&fileExist($zFile)){
      my $cmdStr = "gunzip -c ". $zFile ." | tar -xvf -";
      $conn->cmd(String => $cmdStr,
            Timeout => 120);
     }else{
      die "$zFile: No such file or directory";
     }
    } # end sub tar

    sub setup {
     if (&fileExist($setupFile)){
      my $cmdStr = "./". $setupFile;
      $conn->cmd(String => $cmdStr,
            Timeout => 120);
     }else{
      die "$setupFile: No such file or directory";
     }
    } # end sub setup

    sub display {
     my $cmdStr = "DISPLAY=". $yourPCIPAddress .":0.0;export DISPLAY";
     $conn->cmd($cmdStr);
    } # end sub display

    sub kickEmsadmin {
     my $cmdStr = "pkill -9 -u emsadmin";
     for (1..3) { $conn->cmd($cmdStr);}
    } # end sub kickEmsadmin

    sub arrayToHash {
     my @arrays = @_;
     my %io;
     my $input = 0;
     my $output;
     foreach (@arrays){
      if ($input){
       $io{$output} = $_;
       $input = 0;
      }else{
       $io{$_} = undef;
       $input = 1;
       $output = $_;
      }
     }
     %io;
    } # end sub arrayToHash

    sub uninstall {
     ##Use the undefined value to turn off timing-out completely.
     $conn->timeout(180);
     $conn->errmode('return');
     
     my @arrays = &readFromFile($uninstallFile);
     my $cmdStr = shift @arrays;
     my $doUninstall = $arrays[-1];
     
     my %io = &arrayToHash(@arrays);
     my @output = keys %io;

     my $i = 0;
     $conn->print($cmdStr);
     while(1){
      print "$i in while\n";
      $i += 1;
      ## The amount of @output's element must equal to the number of input line in uninstall.ini file.
      my ($prematch, $match) = $conn->waitfor(String => $output[0],
                          String => $output[1],
                          String => $output[2],
                          String => $output[3],
                          );
      print "\$match is $match\n";
      # check if uninstall complete
      if ($match eq $doUninstall){
       print "Found $match\n";
       $doneUninstall = 1; 
      }
      if ($match && $io{$match}){
       $conn->print($io{$match});
       print "$match => $io{$match}\n";
      }else{
       open FH, "< $inputLog"
        or die "Can't open $inputLog\n";
       my @tmp = <FH>;
       close FH;
       my $lastline = pop @tmp;
       if ($lastline =~ /[\$%#>] $/){
        print "The lastline is $lastline exit uninstall...\n";
        last;
       }
       print "Can't find the following line for waiting in $uninstallFile. Please enter the answer manually.\n$lastline";
       my $enter = <STDIN>;
       $conn->print($enter); 
      }  
     }
    } # end sub uninstall

    sub install {
     ##Use the undefined value to turn off timing-out completely.
     $conn->timeout(360);
     $conn->errmode('return');
     
     my @arrays = &readFromFile($installFile);  
     my $cmdStr = shift @arrays;
     my $doInstall = $arrays[-1];
     
     my %io = &arrayToHash(@arrays);
     my @output = keys %io;
     my $i =0;

     $conn->print($cmdStr);
     while(1){
      print "$i in while\n";
      $i += 1;
      ## The amount of @output's element must equal to the number of input line in install.ini file.
      my ($prematch, $match) = $conn->waitfor(String => $output[0],
                          String => $output[1],
                          String => $output[2],
                          String => $output[3],
                          String => $output[4],
                          String => $output[5],
                          String => $output[6],
                          String => $output[7],
                          String => $output[8],
                          String => $output[9],
                          String => $output[10],
                          String => $output[11],
                          String => $output[12],
                          String => $output[13],
                          String => $output[14],
                          String => $output[15],
                          String => $output[16],
                          String => $output[17],
                          String => $output[18],
                          String => $output[19],
                          String => $output[20],
                          String => $output[21],
                          String => $output[22],
                          String => $output[23],
                          String => $output[24],
                          String => $output[25],
                          String => $output[26],
                          String => $output[27],                      
                          ## Remove a '#' in next line if add a pair of lines in the install.ini file
                          #String => $output[28],
                          #String => $output[29],
                          #String => $output[29],
                          );
      print "\$match is $match\n";  
      # check if install complete
      if ($match eq $doInstall){
       print "Found $match\n";
       $doneInstall = 1;
      }
      if ($match && $io{$match}){
       $conn->print($io{$match});
       print "$match => $io{$match}\n";
      }else{
       open FH, "< $inputLog"
        or die "Can't open $inputLog\n";
       my @tmp = <FH>;
       close FH;
       my $lastline = pop @tmp;
       if ($lastline =~ /[\$%#>] $/){
        print "The lastline is $lastline exit install...\n";
        last;
       }
       print "Can't find the following line for waiting in $installFile. Please enter the answer manually.\n$lastline";
       my $enter = <STDIN>;
       $conn->print($enter); 
      }
     }
    } # end sub install

    sub reboot {
     if ($reboot =~ /yes|y/i){
      my $cmdStr = "sync;sync;/etc/shutdown -y -g0 -i6";
      $conn->cmd($cmdStr);
     }
    } # end sub reboot

    sub restartDB {
     my $cmdStop = "./dbora.ems stop";
     my $cmdStart = "./dbora.ems start";
     $conn->cmd(String => $cmdStop,
           Prompt => '/[#] $/',
           Timeout => 120);
     $conn->cmd(String => $cmdStart,
           Prompt => '/[#] $/',
           Timeout => 120);
     $conn->prompt('/[\$%#>] $/');
    } # end sub restartDB

    sub installPatches {
     if (&fileExist($patchDir)){
      my $cmdStr = "cp $patchDir/* /opt/afc/bbmgr/patchJars/";
      $conn->cmd(String => $cmdStr,
            Timeout => 120);
     }else{
      warn "$patchDir: No such file or directory";
     }
    } # end sub installPatches

    sub readEmsVersion {
     my ($filename, $emsVersion) = @_;
     open FILE, $filename
      or die "Can't open the file: $filename! ($!)";
     chomp($emsVersion = <FILE>);
     close FILE;
     $emsVersion;
    } # end sub readEmsVersion

    sub quit {
     $conn->close;
     exit;
    } # end sub quit

  • silentlyInstallPanINM.pl

    2008-11-12 15:00:08

    $logfile = "installation.log";
    $endOfFile = "Log_is_the_end_of_file";
    $installfile = "interactivelyInstallPanINM.pl";

    ## Clean up log file
    open CLEAN, "> $logfile"
         or die "Can't open the file: $logfile! ($!)";
    close CLEAN;

    ## Call $installfile to write log into the log file
    open FH, "interactivelyInstallPanINM.pl |" or die "fork: $!";

    ## Simulate the tail command.
    open FILE, "< $logfile"
         or die "Can't open the file: $logfile! ($!)";

    ## read until end of file
    while (1) {
        my $_ = <FILE>;
        if (/\b$endOfFile\b/){
          last;
        }else{
         print;
        }
    }
    ## last will goto here
    close FILE;
    close FH;

  • ftp.pl

    2008-11-12 14:59:15

    use Net::FTP::Recursive ();

    $emsVersion = &readEmsVersion("emsversion.ini");

    $hostname = "HOSTNAME";
    $username = "USERNAME";
    $passwd = "PASSWD";
    #$zFile = "ems.$emsVersion.tar.Z";
    $mainDir = "/ems";
    $emsDir = "Panorama_V$emsVersion";
    $envFile = "env.ini";
    $lMainDir = "C:\\Panorama";
    $lFileDir = "$lMainDir\\Panorama_V$emsVersion";

    ##Read environment value from env file.
    &readEnv;

    chdir $lFileDir
     or die "Can't cd to $lFileDir";
     
    $ftp = Net::FTP::Recursive->new($hostname, Debug => 0)
      or die "Cannot connect to $hostname: $@";

    $ftp->login($username, $passwd)
      or die "Cannot login ", $ftp->message;

    $ftp->binary;

    $ftp->cwd($mainDir)
      or die "Cannot change working directory ", $ftp->message;

    $ftp->rmdir($emsDir, 'true');
     
    $ftp->mkdir($emsDir)
      or die "Cannot create the directory ", $ftp->message;

    $ftp->cwd($emsDir)
      or die "Cannot change working directory ", $ftp->message;

    print "Upload...\n";

    $ftp->rput()
     or die "put failed ", $ftp->message;
     
    $ftp->quit;
    exit;

    sub readEmsVersion {
     my ($filename, $emsVersion) = @_;
     open FILE, $filename
      or die "Can't open the file: $filename! ($!)";
     chomp($emsVersion = <FILE>);
     close FILE;
     $emsVersion;
    } # end sub readEmsVersion

    sub readEnv {
     my ($name, $value, $num, @field);
     open FILE, $envFile
      or die "Can't open the file: $envFile! ($!)";
     while(<FILE>){
      chomp;
      # go to next while if a line in $envFile is an empty or its first char is #
      next if ($_ eq "" || /^#/);
      @field = split /=/, $_;
      # get the amount of @field's element
      $num = @field;
      die "The value should be inside the \"\", please check your $envFile file.\n" if ($num < 2);
      $value = pop @field;
      $name = pop @field;
      $name =~ s/^\s+|\s+$//g;
      $value =~ s/^"|"$|^\s+|\s+$//g;
      $value =~ s/EMSVERSION/$emsVersion/g;
      die "Find an empty attribute name, please check your $envFile file.\n" if ($name eq "");
      if ($name eq $hostname){
       $hostname = $value;
      }elsif ($name eq $username){
       $username = $value;
      }elsif ($name eq $passwd){
       $passwd = $value;
      }
      ## next will goto here
     }
     close FILE;
    } # end sub readEnv

  • checkRelease.pl

    2008-11-12 14:58:11

    #use warnings;
    $emsVersion = readEmsVersion("emsversion.ini");
    ## decide if call silentlyInstallPanINM.pl
    $autoUpdate = "no";
    my $lMainDir = "C:\\Panorama";
    my $lFileDir = "$lMainDir\\Panorama_V$emsVersion";
    my $rFileDir = "\\\\dtsmbsvr\\replica\\EMS\\Panorama_V$emsVersion";
    #my $rFileDir = "$lMainDir\\temp\\Panorama_V$emsVersion";
    my $lFilename = "$lFileDir\\cdrom\\ems.$emsVersion.tar.Z";
    my $rFilename = "$rFileDir\\cdrom\\ems.$emsVersion.tar.Z";
    #my $lFilename = "$lFileDir\\cdrom\\ReleaseNotes.doc";
    #my $rFilename = "$rFileDir\\cdrom\\ReleaseNotes.doc";

    open CHKLOG, "> checkRelease.log"
     or die "Can't create checkRelease.log: $!";
    #exit unless &fileExist($rFilename);
    &quit unless &fileExist($rFilename);

    system "mkdir $lMainDir" unless &fileExist($lMainDir);

    if (&fileExist($lFilename)){
     ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $latime, $lmtime, $lctime, $blksize, $blocks) = stat($lFilename);
     ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $ratime, $rmtime, $rctime, $blksize, $blocks) = stat($rFilename);
     my $lmdate = localtime $lmtime;
     my $rmdate = localtime $rmtime;
     &printLog ("Local file name is $lFilename\n");
     &printLog ("Remote file name is $rFilename\n");
     &printLog ("Local modified time is $lmtime\n");
     &printLog ("Remote modified time is $rmtime\n");
     &printLog ("Local modified date is $lmdate\n");
     &printLog ("Remote modified date is $rmdate\n");
     # check if need to update
     if ($lmtime == $rmtime){
      &printLog ("Local modified time equals to remote modified time. Don't need update release $emsVersion\nExit...\n");
      #exit;
      &quit;
     }else{
      # The source file is newer than destination. Replace..
      &printLog ("The source file is newer than destination. Replace ems.$emsVersion.tar.Z... \n");
      #my $msg = `xcopy /Y $rFilename $lFilename`;
      my $msg = `C:\\WINDOWS\\system32\\xcopy.exe $rFilename $lFilename /Y`;
      &printLog ($msg);
      system "ftp.pl";
     }
    }else{
     #copy ...
      &printLog ("Copy $rFileDir to $lFileDir ...\n");
      my $msg = `C:\\WINDOWS\\system32\\xcopy.exe $rFileDir $lFileDir  /I /E /Y`;
      &printLog ($msg);
      system "ftp.pl";
    }
    if ($autoUpdate =~/yes|y/i){
     &printLog ("Call silentlyInstallPanINM.pl ...\n");
     system "silentlyInstallPanINM.pl";
    }
    close CHKLOG;

    system "email.pl";

    sub printLog {
     my ($msg) = @_;
     print $msg;
     print CHKLOG $msg;
    } # end sub printLog

    sub readEmsVersion {
     my ($filename, $emsVersion) = @_;
     open FILE, $filename
      or die "Can't open the file: $filename! ($!)";
     chomp($emsVersion = <FILE>);
     close FILE;
     $emsVersion;
    } #  end sub readEmsVersion

    sub fileExist {
     my ($filename) = @_;
     if(-e $filename){
      -1;
     }else{
      &printLog ("Can't find the file: $filename\n");
      0;  
     }
    } # end sub fileExist

    sub quit {
     system "email.pl";
     exit;
    } # end sub quit

  • Silent installation-版本维护安装的福音

    2008-11-12 14:55:21

    test engineer(特别是维护安装release的)日常工作中经常会重复以下步骤,请各位对号入座:

    1、收到版本发布者的正式邮件,有新版本发布。
    2、去发布服务器上check版本,拷贝到本地共享,并上传到测试服务器上。
    3、Installation new load。
    4、sanity test if step 3 is ok.
    5、给全体测试同仁发送email,新版本已成功安装在测试服务器上 if step 4 is ok.

    我在经历了一轮又一轮的折磨后,终于决定用Perl来实现以上功能。
    考虑的问题:
    0、main.pl
    依次call以下脚本checkRelease.pl、ftp.pl、silentlyInstall.pl、email.pl。
    建立一个windows task,在每天固定的时间运行这个脚本。

    1、checkRelease.pl
    这个脚本的用途是:从文件中读取最近的一个版本号,根据版本号检查发布服务器是否有新的release发布,并与本地release比对是否更新,
    如果新则拷贝到本地,并上传到solaris,完成后根据版本号规则更新文件中的版本号。

    2、ftp.pl
    使用Net::FTP::Recursive模块批量上传文件,类似mput命令。

    3、silentlyInstall.pl
    用来实时打印、写安装日志,安装功能其实是interactivelyInstall.pl这个脚本完成的

    4、interactivelyInstall.pl
    核心模块,先从配置文件中读取一大堆变量值。使用Net::Telnet模块中的print()、cmd()、waitfor()等函数实现silent安装。

    5、email.pl
    以上成功后发送email给全体测试同仁。

    后面的帖子会将具体的代码贴上来,因为最近换了个部门,代码没整理过,比如没main.pl,用checkRelease.pl代替,将就看了。
    还有个问题是,我在本地的代码都是缩进过的,但是copy到这里就乱了。

     

  • Use the Net::FTP module

    2008-11-12 14:16:33

    use Net::FTP;

    $ftp = Net::FTP->new("some.host.name", Debug => 0)
      or die "Cannot connect to some.host.name: $@";

    $ftp->login("anonymous",'-anonymous@')
      or die "Cannot login ", $ftp->message;

    $ftp->cwd("/pub")
      or die "Cannot change working directory ", $ftp->message;

    $ftp->get("that.file")
      or die "get failed ", $ftp->message;

    $ftp->quit;

  • Use the Net::Telnet module

    2008-11-12 14:12:03

    use warnings;
    use Net::Telnet ();
    my ($hostname, $username, $passwd);
    $hostname = "192.168.120.48";
    $username = "cnshroot";
    $passwd = "shroot";
    $telnet = new Net::Telnet (Timeout => 10,
                          Prompt => '/-bash-3\.00# $/');
    $telnet->open($hostname);
    $telnet->login($username, $passwd);
    @lines = $telnet->cmd("who");
    print @lines;
    $telnet->close;
    exit;
  • Use perl to simulate tail command

    2008-11-12 14:08:35

    $logfile = "installation.log";
    $endOfFile = "Log_is_the_end_of_file";
    $installfile = "interactivelyInstallPanINM.pl";

    ## Clean up log file
    open CLEAN, "> $logfile"
         or die "Can't open the file: $logfile! ($!)";
    close CLEAN;

    ## Call $installfile to write log into the log file
    open FH, "interactivelyInstallPanINM.pl |" or die "fork: $!";

    ## Simulate the tail command.
    open FILE, "< $logfile"
         or die "Can't open the file: $logfile! ($!)";

    ## read until end of file
    while (1) {
        my $_ = <FILE>;
        if (/\b$endOfFile\b/){
          last;
        }else{
         print;
        }
    }
    ## last will goto here
    close FILE;
    close FH;

  • Use the Net::SMTP module to send an email through an ms exchange smtp server

    2008-11-12 14:02:02

    use Net::SMTP;

    my $smtpSer = 'mailhost';
    my $from = 'from@xxx.com';
    my $to = 'to@xxx.com';
    my $subject = 'Test';
    my $body = "A simple test message";

    $smtp = Net::SMTP->new($smtpSer);

    $smtp->mail($ENV{USER});
    $smtp->to($to);

    $smtp->data();
    $smtp->datasend("From: $from\n");
    $smtp->datasend("To: $to\n");
    $smtp->datasend("Subject: $subject\n");
    $smtp->datasend("Body: $body\n");
    $smtp->dataend();

    $smtp->quit;

    ##############################################################################

    perldoc Net::SMTP for more details

    If you need authentication (ie. server does not relay) then substitute Net::SMTP for Net::SMTP_auth. The trick to make this two work together is to create a email message with MIME::Lite (you can add attachments, use html or text) then convert the MIME::Lite object into a string (there is a method to do it within the module) then using the datasend(string) method from Net::SMTP your email will be ready to go.

  • 第十六章:一些高级Perl技术

    2008-11-12 13:34:26

    还没做……
  • 第十五章:Perl模块

    2008-11-12 11:42:29

    1)
    use warnings;
    use Module::CoreList;
    my %modules = %{ $Module::CoreList::version{5.006} };
    print join "\n", keys %modules;

    2)
    use warnings;
    use Cwd;
    use File::Spec;
    my $cwd = getcwd();
    my @files = glob ".* *";
    foreach my $file (@files){
     my $path = File::Spec->catfile($cwd, $file);
     print "$path\n"; 
    }

    3)
    use warnings;
    use Cwd;
    use File::Spec;
    use File::Basename;

    my $cwd = getcwd;
    my @files = glob ".* *";
    foreach my $file(@files){
     my $path = File::Spec->catfile($cwd, $file); 
     my $basename = basename $path;
     print "$basename\n";
    }

  • 第十四章:进程管理

    2008-11-12 11:41:35

    1)
    use warnings;
    chdir "/" or die "Can't chdir to root directory: $!";
    exec "ls", "-l" or die "Can't exec ls: $!";
    #my $info = `ls -l /`;
    #print $info;

    2)
    use warnings;
    open STDOUT, ">ls.out" or die "Can't write to ls.out: $!";
    open STDERR, ">ls.err" or die "Can't write to ls.err: $!";
    chdir "/" or die "Can't chdir to root directory: $!";
    exec "ls", "-l" or die "Can't exec ls: $!";
    #my $info = `ls -l / > ls.out 2>&1`;

    3)
    use warnings;
    my $date = `date`;
    my $day = substr $date, 0, 3;
    if ($day eq "Sun" or $day eq "Sat"){ #if(`date` =~ /^(Sat|Sun)/)
     print "go play!\n"; 
    }else{
     print "get to work!\n"; 
    }

803/4<1234>
Open Toolbar