• 常规任务

    SMF 是 Solaris 中一项特别显著的更改,因为它影响了管理模型。因此,尽管我们鼓励您阅读有关 SMF 功能的详细信息(请参见以下 “详细信息” 部分),但您可能还是希望从学习如何执行一些常规系统管理任务开始。

    ◆启用和禁用服务

    在 Solaris 10 之前的版本中,没有一个很好的方法来永久禁用 Solaris 中的服务。常用方法是将相应的 rc 脚本重命名为不再执行的名称,但在下一次系统升级后此更改将会失效。此外,基于 inetd 的服务是通过一种完全不同的方法(即编辑配置文件)启用和禁用的。在 SMF 下,可以使用 svcadm(1M) 命令配置这两种类型的服务,并且在计算机升级后这些更改将持续有效。以下是对启用和禁用某些服务的方式的比较:

    旧方法:mv /etc/rc2.d/S75cron /etc/rc2.d/x.S75cron SMF 方法:svcadm disable system/cron:default

    旧方法:编辑 /etc/inet/inetd.conf,将 finger 行取消注释

    SMF 方法:svcadm enable network/finger:default

    在上述示例中,svcadm 的最后一个参数是服务的 FMRI。

    请注意,svcadm 仅用于 SMF 服务,由 rc 脚本控制的传统服务与在早期发行版中的工作方式相同。

    ◆停止、启动和重新启动服务

    过去,服务已由引导时运行的 rc 脚本启动,并通过 start 参数运行。一些 rc 脚本提供了 stop 选项,少数 rc 脚本还允许使用 restart。在 SMF 中,这些任务都是通过 svcadm(1M) 命令完成的:

    旧方法:/etc/init.d/sshd stop SMF 方法:svcadm disable -t network/ssh:default

    旧方法:/etc/init.d/sshd start SMF 方法:svcadm enable -t network/ssh:default

    旧方法:/etc/init.d/sshd stop; /etc/init.d/sshd start SMF 方法:svcadm restart network/ssh:default

    旧方法:kill -HUP cat /var/run/sshd.pid

    SMF 方法:svcadm refresh network/ssh:default

    svcadm enable 和 svcadm disable 的 "-t" 选项表示所请求的操作应该是临时的 (temporary),它不会影响此服务是否会在系统下一次引导时启动。这与上述 “启用和禁用服务” 示例形成了对比。

    与启用和禁用服务一样,不应该使用 svcadm 控制由 rc 脚本控制的服务;这些服务将始终按早期发行版中的方式工作。

    ◆观察引导过程

    如 “显著的更改” 部分所述,在缺省情况下,引导过程与早期的 Solaris 发行版相比要精简得多。这样就减少了不能提供有价值信息的 “无用消息”,这些 “无用消息” 可能会导致引导期间发生的任何实际问题不容易被发现。

    已添加一些新的引导选项,以控制引导的详细程度。您可能会发现一个特别有用的选项 "-m verbose",该选项在每个服务尝试启动时打印一行信息。这与基于 Unix 和与 Unix 相似的某些其他操作系统的缺省引导模式相似。详细的引导过程如下所示:

    {1} ok boot -m verbose

    Rebooting with command: boot -m verbose Boot device: /pci@1c,600000/scsi@2/disk@0,0:a File and args: -m verbose SunOS Release 5.10 Version Generic 64-bit Copyright 1983-2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. [ network/pfil:default starting (pfil) ] [ network/loopback:default starting (Loopback network interface) ] [ system/filesystem/root:default starting (Root filesystem mount) ] Oct 18 13:53:02/13: system start time was Mon Oct 18 13:52:57 2004 [ network/physical:default starting (Physical network interfaces) ] system/filesystem/usr:default starting (/usr and / mounted read/write) [ system/filesystem/local:default starting (Local filesystem mounts) ] [ network/ntp:default starting (network time protocol (NTP)) ] [ system/utmp:default starting (utmpx monitoring) ] [ system/filesystem/local:default starting (Local filesystem mounts) ] [ system/console-login:default starting (Console login) ]

    demobox console login: checking ufs filesystems /dev/rdsk/c0t0d0s7: is logging. Oct 18 13:53:14/50: system/system-log:default starting Oct 18 13:53:14/51: network/inetd:default starting Oct 18 13:53:14/52: system/cron:default starting ( more service messages elided )

    服务启动消息的顺序在每次引导时可能会有所不同,因为 SMF 将按照服务的相关性关系并行启动这些服务。

    如果服务无法成功启动,则除了打印启动消息之外,还会打印警告消息。以下是 NTP 服务无法启动的一个示例:

    [ system/filesystem/local:default starting (Local filesystem mounts) ] [ network/ntp:default starting (network time protocol (NTP)) ] Oct 25 13:58:42/49 ERROR: svc:/network/ntp:default: Method "/lib/svc/method/xntp" failed with exit status 96. Oct 25 13:58:42 svc.startd[4]: svc:/network/ntp:default: Method "/lib/svc/method/xntp" failed with exit status 96. [ network/ntp:default misconfigured (see 'svcs -x' for details) ] system/utmp:default starting (utmpx monitoring)

    前两条错误消息在正常引导和详细引导期间都会显示;最后一条错误消息 ("network/ntp:default misconfigured ...") 仅在详细引导期间显示。

    ◆发现故障

    Solaris 尚未提供一个全面的用于查找系统服务问题的方法。目前存在一些可帮助捕获并诊断这些问题的解决方案,包括使用 coreadm(1M) 命令记录到特定于站点的监视脚本,以及 Sun Cluster 等综合性产品。新的 svcs(1) 命令包含一个 “解释” 选项 ("svcs -x"),可打印出有关未运行服务的详细消息(由解决方案驱动)。svcs -x 将显示服务失败的时间和原因,提供获取此问题详细信息的方式,并列出受此问题影响的其他服务。

    继续来看一下无法启动的 NTP 服务的示例:

    svcs -x

    svc:/network/ntp:default (Network Time Protocol (NTP).) State: maintenance since Mon Oct 18 13:58:42 2004 Reason: Start method exited with $SMF_EXIT_ERR_CONFIG. See: http://sun.com/msg/SMF-8000-KS See: ntpq(1M) See: ntpdate(1M) See: xntpd(1M) Impact: 0 services are not running.

    NTP 服务已被置于维护模式,因为启动脚本指示该服务的配置存在问题。有关服务故障的详细信息,请参见 /var/svc/log 目录(或 /etc/svc/volatile 目录)中该服务的日志文件。日志文件名基于简短形式的 FMRI,将 "/" 替换为 "-"。因此,svc:/network/ntp:default 服务的日志文件为 /var/svc/log/network-ntp:default.log。通过此日志文件可以快速得出结论,即 NTP 守护进程的配置文件 /etc/inet/ntp.conf 已被删除。

    以下是另一个示例,显示了 SMF 可以跟踪相关性,并指出与禁用的服务相关的问题。在此示例中,我们使用 "-v" 选项来查看受影响的服务的列表。

    svcs -x -v

    svc:/application/print/server:default (LP Print Service) State: disabled since Mon Oct 18 16:17:27 2004 Reason: Disabled by an administrator. See: http://sun.com/msg/SMF-8000-05 See: man -M /usr/share/man -s 1M lpsched Impact: 1 service is not running: svc:/application/print/rfc1179:default

    在以上示例中,已明确禁用了 application/print/server:default 服务,但未禁用依赖于该服务的另一个服务 (application/print/rfc1179:default)。因此,禁用第一个服务已使得第二个服务无法运行。

  • Perl +~ at 2008年11月07日

    3.6 绑定操作符 双目 =~ 把一个字串和一个模式匹配、替换或者转换绑定在一起。要不然这些操作会搜索或修改包含在 $_(缺省变量)里面的字串。你想绑定的字串放在左边,而操作符本身放在右边。返回值标识右边的操作符的成功或者失败,因为绑定操作符本身实际上不做任何事情。

    如果右边的参数是一个表达式而不是模式匹配、子过程或者转换,那运行时该表达式会被解释成一个搜索模式。也就是说,$_ =~ $pat 等效于 $_ =~ /$pat/。这样做要比明确搜索效率低,因为每次计算完表达式后都必须检查模式以及可能还要重新编译模式。你可以通过使用 qr//(引起正则表达式)操作符预编译最初的模式的方法来避免重新编译。

    双目 !~ 类似 =~ 操作符,只是返回值是 =~ 的对应返回值的逻辑非。下面的表达式功能上是完全一样的:

    $string !~ /pattern/ not $string =~ /pattern/ 我们说返回值标识成功,但是有许多种成功。替换返回成功替换的数量,转换也一样。(实际上,转换操作符常用于字符计数。)因为任何非零值都是真,所以所有的都对。最吸引人的真值类型是模式的列表赋值:在列表环境下,模式匹配可以返回和模式里圆括弧相匹配的子字串。不过,根据列表赋值的规则,如果有任何东西匹配并且赋了值,列表赋值本身将返回真,否则返回假。因此,有时候你会看到这样的东西: if( ($k, $v) = $string =~ m/(\w+)=(\w*)/) { print "KEY $k VALUE $v\n"; } 让我们分解这个例子。 =~ 的优先级比 = 高,因此首先计算 =~。 =~ 把字串 $string 绑定与右边的模式进行匹配,右边是扫描你的字串里看起来象 KEY=VALUES 这样的东西。这是在列表环境里,因为它是在一个列表赋值的右边。如果匹配了模式,它返回一个列表并赋值给 $k 和 $v。列表赋值本身是在标量环境,所以它返回 2--赋值语句右边的数值的个数。而 2 正好又是真——因为标量环境也是一个布尔环境。当匹配失败,没有赋值发生,则返回零,是假。 关于模式规则的更多内容,参阅第五章,模式匹配。

  • perl at 2008年11月07日

      2. Perl 诗歌   在助手框里的诗歌的仿制品是在 1990 年的四月一日愚人节张贴到 Usenet 上的。我们不加注释的把它放在这里,只是想表示典型的编程语言的隐喻真的是多么让人作呕。对所有有文学价值的东西大概都是这样的吧。Larry 在最初为 Perl 3 写的那些 “Black Perl” 到了 Perl 5 不能分析通过之后,真是感觉轻松许多。   不过,Larry 自己的文集很幸运地被 Perl 诗歌的王后,Sharon Hopkins 的光芒所掩盖。她写了相当多的 Perl 诗歌,以及一些她在 1992 年 Usenet 冬季技术大会上拿出来的关于 Perl 诗歌的文章,标题是 “Camels and Needles: Computer Poetry Meets the Perl Programming Language”。(这篇文章可以在 CAPN 的 misc/poetry.ps 找到。)除了是最多产的 Perl 诗人之外,Sharon 还是下面这首诗歌的作者,这首诗是发表得最广泛的一首,并且曾经在 Economist 和 Guardian 杂志上刊登:

      #!/usr/bin/perl   APPEAL:   listen (please, please);   open yourself, wide;   join (you, me),   connect (us,together),   tell me.   do something if distressed;   @dawn, dance;   @evening, sing;   read (books,$poems,stories) until peaceful;   study if able;   write me if-you-please;   sort your feelings, reset goals, seek (friends, family, anyone);   do*not*die (like this)   if sin abounds;   keys (hidden), open (locks, doors), tell secrets;   do not, I-beg-you, close them, yet.   accept (yourself, changes),   bind (grief, despair);   require truth, goodness if-you-will, each moment;   select (always), length(of-days)   # listen (a perl poem)   # Sharon Hopkins   # rev. June 19, 1995   Perl Poetry   Article 970 of comp.lang.perl:   Path: jpl-devvax! pl-dexxav! lwall   From: lwall@jpl-dexxav.JPL.NASA.GOV(Larry Wall)   Newsgroups: news.groups,rec.arts.poems,comp.lang.perl   Subject: CALL FOR DISCUSSION: comp.lang.perl.poems   Message-ID: 0401@jpl-devvax.JPL.NASA.GOV   Date: 1 Apr 90 00:00:00 GMT   Reply-To: lwall@jpl-devvax.JPL.NSAS.GOV(Larry Wall)   Organization: Jet Prepulsion Laboratory, Pasadena, CA   Lines: 61   It has come to my attention that there is a crying need for a place for people to express both their emotional   and technical natures simultaneously. Several people have sent me some items which don't fit into any   newsgroup. Perhaps it's because I recently posted to both comp.lang.perl and to rec.arts.poems, but people   seem to be writing poems in Perl, and they're asking me where they should post them. Here is a sampling:   From a graduate student (in finals week), the following haiku:   study, write, study,   do review (each word) if time.   close book. sleep? what's that?   And someone writing from Fort Lauderdale writes:   sleep, close together,   sort of sin each spring & wait;   50% die   A person who wishes to remain anonymous wrote the following example of "Black Perl". (The Pearl poet   would have been shocked, no doubt.)   BEFOREHAND: close door, each window & exit; wait until time.   open spellbook, study, read (scan, select, tell us);   write it, print the hex while each watches,   reverse its length, write again;   kill spiders, pop them, chop, split, kill them.   unlink arms, shift, wait & listen (listening, wait),   sort the flock (then, warn the "goats" & kill the "sheep");   kill them, dump qualms, shift moralities,   values aside, each one;   die sheep! die to reverse the system   you accept (reject, respect);   next step,   kill the next sacrifice, each sacrifice,   wait, redo ritual until "all the spirits are pleased";   do it ("as they say").   do it(everyonemustparticipateinforbiddens*e*x).   return last victim; package body;   exit crypt (time, times & "half a time") & close it,   select (quickly) & warn your next victim;   AFTERWORDS: tell nobody.   wait, wait until time;   wait until next year, next decade;   sleep, sleep, die yourself,   die at last   I tried that, and it actually parses in Perl. It doesn't appear to do anything useful, however. I think I'm glad,   actually... I hereby propose the creation of comp.lang.perl.poems as a place for such items, so we don't clutter   the perl or poems newsgroups with things that may be of interest to neither. Or, alternately, we should   create rec.arts.poems.perl for items such as those above which merely parse, and don't do anything useful.   (There is precedent in rec.arts.poems, after all.) Then also create comp.lang.perl.poems for poems that   actually do something, such as this haiku of my own:   print STDOUT q   Just another Perl hacker,   unless $spring   Larry Wall lwall@jpl-devvax.jpl.nasa.gov

  • 你们 linux,solaris 系统怎么备份的啊?

  • EMMALHY at 2008年11月07日

    多谢多谢~:loveliness:

  • 最近 moto 裁人裁的厉害啊,新 CEO 上任,大刀阔斧的改革 ing。。。。。

  • EMMALHY at 2008年11月06日

    :victory: :victory: :victory:

    支持

  • Solaris8 下安装 SSH 总汇 at 2008年11月06日

    创建自启动控制文件 1)sshd 启动脚本: vi /etc/init.d/sshd #! /bin/sh #

    start/stop the secure shell daemon

    case "$1" in 'start') # Start the sshd daemon if [ -f /usr/local/sbin/sshd ]; then echo "starting SSHD daemon" /usr/local/sbin/sshd & fi ;; 'stop') # Stop the ssh deamon PID=/usr/bin/ps -e -u 0 | /usr/bin/fgrep sshd | /usr/bin/awk '{print $1}' if [ ! -z "$PID" ] ; then /usr/bin/kill ${PID} >/dev/null 2>&1 fi ;; *) echo "usage: /etc/init.d/sshd {start|stop}" ;; esac 2) 设置 sshd 启动脚本 #chmod +x /etc/init.d/sshd #ln -s /etc/init.d/sshd /etc/rc2.d/S99sshd

  • Linux cron 的使用 at 2008年11月06日

    一般是网站需要定时更新时会用到此功能。相比 Windows 需要通过计划任务或者第三方软件来实现,linux 相比而言会方便很多。当然,一开始需要学习一下它的规则。

    一种方法将需要执行的文件 copy 到其自带的目录中。

    如 cp shell.php /etc/cron.daily/ 则 shell.php 每天都会运行一次。 cp shell.php /etc/cron.hourly/ 每小时执行一次。

  • clearquest 用户管理介绍 at 2008年11月05日

    CMing 于 2008-11-5 13:36 发表
    没有。

    自学 SVN,看看它是怎么回事。。

    哈哈~~ [/quote]

    呵呵,小规模开发利器。效率高,简单易用。

  • Perl 对于一个 CM 太重要了 at 2008年11月05日

    今天经理说 Perl 是 CM 必备技能-,-

    CM 不会 Perl,就不是一个合格的 CM 工程师:Q :Q :Q

  • ClearCase 介绍 at 2008年11月05日

    EMMALHY 于 2008-11-5 10:20 发表
    莫名的说…… [/quote]

    有心人啊有心人啊

    通俗易懂的笔记~~

  • solaris 的 vi 用法 at 2008年11月04日

    VI COMMANDS

    以下命令皆在 vi 命令模式下执行。 为避免 ex:符号与 ex 命令混淆 所有要输入的指令皆用蓝色表示 不显示 ex:(举例说明的英文缩写)

    : 表示先按住 ctrl 键再按 A 有些命令小写也可以用

    移动命令: 往下移动到这个字下次一出现的地方。

    标向上移动一个萤幕。

    标往下移动数行(约 12 行)。

    将萤幕往上一行,但标位置不变。

    标往下移动一个萤幕。

    + 标往下移动到下一行第一个非空白字元。

    标往上移动数行(约 12 行)。

    将萤幕往上动,但标位置不变. CTRL+Y 每移动一次 Y 就按一次 (当然您的标须位在至少能够向上动的位置)

    $ 将标移动到该行尾.

    ( 标往上移动到下一句子.

    ) 标往下移动到下一句子.

    - 标移动到上一行第一个非空白字元.

    0(数字) 移动标到该行的第一个字元 (包含空白).

    < 移动该行向左移动一个 tab 键距离,按第二次後开始动作.

    > 移动该行向右移动一个 tab 键距离,按第二次後开始动作.

    B 往上移动标到下一个字的开始.

    E 标往後移动到下一个字的最後一个字元.

    nG 移动到某行,n 为行数,若没有指定则为档案的最後一行.

    H 移动标到档案第一行行首.

    L 将标移动到萤幕的最下一行.

    M 将标移动到萤幕的中间行.

    W 往下移动标到下一个字的开始.

    ^ 移到该行第一个非空白字元.

    e 移动到该字的最後一字母.

    f<字元> 行中向後搜寻该字母并移动标到该位置. 移动到 a 字母的位置 fa

    t<字元> 行中向後搜寻该字母并移动标到该字元前一个位置.

    { 往上移动到前一段落.

    } 往下移动到後一段落.

    档案命令:

    显示档案的资讯。 显示出目前档案是否更改,所在行的位置. file_name: unmodified : line 1 of 380 [0%]

    重画萤幕。

    重画萤幕。

    暂停编辑 回到 shell,可用 fg 回到编辑画面

    切换到最近编辑的档案. vi file_name file_name2 用此命命可以在两个档案中切换.

    ZZ 将文件存档并离开 vi

    编辑命令:

    输入: I 移动标道行首的第一个字元并开始接受输入.

    R 以取代模式进入输入模式.

    : Y 该行到暂存区

    删除: D 从标目前位置道行尾的所有字元删除..

    S 将该行清除并进入输入模式.

    X 删除标之前的一个字元

    取代: ! shell 命令 ! 後接 shell comd ,并以 shell cmd 执行结果取代标该行. ! panda 用以下讯息取代原有行的内容 bash: panda: command not found

    r 按 r 後接着按某字元,以取代标所在的该字元.

    ~ 切换标所在字元的大小写 重: & 在该行重之前的规则表示式. 前提是需要之前有执行过规则表示式. 用 panda 取代 a :s/a/panda/ 若之前没有任何表示式 则系统会显示如下讯息 No previous regular expression

    . 重上一个更改文件内容的 vi 命令.

    n 搜寻之前所搜寻过的字串 若先执行 /BSD 再执行 n 等同於执行 /BSD 若先前没有搜寻任何东西 会有如下讯息 No previous search pattern.

    复原: U 恢复状态到标起初接触此行的状态

    u 复原前一个动作产生的效果 (也就是回复)

    其他: : 执行 ex 命令

    J 将下一行与此行合.

    Q 离开 vi 模式并切换到 ex 模式.

  • “You don't seem to have a valid license. Please purchase a license from http://www.ActiveState.com/PDK

    当你运行 perl 的程序遇到了上边的 error 信息,可能你就需要看看这篇文章。

    本文转载自:http://www.herongyang.com/Perl/perl2exe-Convert-Perl-Script-to-Executable-Binary.html

  • This section provides a tutorial example of running PerlApp fromActiveStat to convert a sample Perl script, DirGrep.pl, to Windowsexecutable binary, DirGrep.exe.

    Running PerlApp to convert a Perl script to an executable program is simple. Let's take my DirGrep.pl as an example: #- DirGrep.pl #- Copyright (c) 1995 by Dr. Herong Yang, http://www.herongyang.com/ # ($expression, $dir) = @ARGV; die "Missing regular expression.\n" unless $expression; $dir = "." unless $dir; $fileCount = 0; $matchCount = 0; $textCount = 0; $otherCount = 0; &loopDir($dir); print "Number of matched lines = $matchCount\n"; print "Number of files with matched lines = $fileCount\n"; print "Number of text files searched = $textCount\n"; print "Number of other files not searched = $otherCount\n"; exit; sub loopDir { local($dir) = @_; local(*DIR); opendir(DIR, $dir) || die "Cannot open $dir\n"; while ($f=readdir(DIR)) { next if ($f eq "." || $f eq ".."); $f = "$dir\$f"; if (-d $f) { &loopDir($f); } elsif (-T $f) { $textCount++; if ($n=&fileGrep($f)) { $matchCount += $n; $fileCount++; } } else { $otherCount++; } } closedir(DIR); } sub fileGrep{ local($file) = @_; open(IN, "< $file"); $n = 0; $l = 0; while() { $l++; if (/$expression/i) { $n++; print "$file, line $l\n" ; print; print "\n"; } } close(IN); return $n; } Run the following commands to convert it into a Windows executable program and test it:

    \pdk\bin\perlapp DirGrep.pl

    PerlApp 6.0.1 build 138990 ...

    • WARNING: Applications generated by this evaluation copy of PerlApp
    • will stop working after the end of the evaluation period. ... Created 'DirGrep.exe'

    DirGrep binary .

    ... ..\htm\binary.html, line 18

  • How to open files for input in binary mode.

    ..\htm\binary.html, line 20

  • How to open files for output in binary mode. ... As you can see from the output, the converted program DirGrep.exe works nicely. Now I can pass my DirGrep tool to anyone who is using Windows system without Perl installed.
  • This section provides a tutorial example of installing Perl Dev Kitfrom ActiveStat, which contains a tool, perlapp, to convert Perlprogram into a standalone application.

    Since I have ActivePerl from ActiveState installed on my machine, I am going to try Perl Dev Kit (PDK) from ActiveState. Note that PDK is not a freeware like ActivePerl. But it offers a 21-day trial license.Here is how I installed PDK on my system:

    1. Go to http://www.activestate.com/Products/Perl_Dev_Kit/ and download PDK-Deployment-6.0.1.138990.msi.The file is about 6 MB.
    2. Double click on PDK-Deployment-6.0.1.138990.msi to install it to a directory called: \pdk.
    3. To try it, run the perlapp in a command window as: >\pdk\bin\perlapp -help

    You don't seem to have a valid license. Please purchase a license from http://www.ActiveState.com/PDK

    1. Ok, now go back to http://www.activestate.com/Products/Perl_Dev_Kit/ and click the "Try" button. You need to fill in a form to register yourself for a trial license key.
    2. After submitting the form, I got an email with a download link. So I followed the link and downloadeda file called: T20ABCC9A1-PLDK60T-1466.exe.
    3. Double click on T20ABCC9A1-PLDK60T-1466.exe to install the 21-day trial license.
    4. Run the perlapp again: >\pdk\bin\perlapp -help

    NAME perlapp - Convert Perl program into a standalone application

    SYNOPSIS
    ... Very cool, I got PDK running on my system.

  • This section describes why and how to convert Perl script files to executable binary files. ActivePerl Dev Kit and Perl2Exe are two popular conversion tools for Windows systems. It happens very often that you have developed a very nice Perl script to perform a common task, and someone else also needs to perform this task. So you decide to share your script with him/her. But he/she knows nothing about Perl and does not have Perl installed on his/her system. The simplest way to share your script in this case is to convert it into an executable program.

    There are two general approaches to convert Perl scripts into executable programs:

    * Using the standard Perl compilation tool, perlcc, to convert Perl scripts into C source codes and then compiled into executable programs. * Using "Perl Dev Kit (PDK)" from ActiveState to convert Perl scripts directly into Windows executable programs. * Using Perl2Exe from IndigoSTAR Software to convert Perl scripts directly into Windows executable programs.

  • EMMALHY 于 2008-10-31 17:13 发表
    新的 都是新的 [/quote]

    嗯,嗯,我也是新人

    一起学习,一起学习

  • How to use cron command in solaris at 2008年10月31日

    scmroad 于 2008-10-31 17:18 发表
    AUTHOR: Amalan DATE: 02-27-07 03:10 Hi,

    Hope you know the format of an entry in the crontab.

    "/var/spool/cron/crontabs" ( in solaris 8 ) is the directory where the crontab files of different user ... [/quote]

    GOOOOD,,,,整了一下午都没搞定 Solaris cron

    在这篇文章的帮助下终于搞定了。。ft,ft,我恨 solaris。啊啊阿啊啊啊啊

  • How to use cron command in solaris at 2008年10月31日

    AUTHOR: Amalan DATE: 02-27-07 03:10 Hi,

    Hope you know the format of an entry in the crontab.

    "/var/spool/cron/crontabs" ( in solaris 8 ) is the directory where the crontab files of different users are available.

    Approach 1 :

    write a script with the following commands:

    If you want to update the crontab entry of the same user you logged in ( ex. You logged in to the machine as "root" and you want to update the crontab entry for the root user ) then,

    1. "crontab -l > root.txt"

    The above command will redirct all the entries in the "root" file to "root.txt"

    1. Update the "root.txt" with what you want to add
    2. "crontab root.txt"
    3. rm root.txt

    The step 3 will update the "root" file with the entries in the "root.txt" file

    Approach 2: The same steps can be done in your program

    Hope i am clear

    Thanks, Amalan

  • How to use cron command in solaris at 2008年10月31日

    I recommend using a third party application like VisualCron. VisualCron works like cron in unix/linux but has a graphical interface and is easy to use. You can check the VisuaCron homepage here:

    http://www.visualcron.com

  • Solaris 问答集 at 2008年10月31日

    117 Q: 我们有一台 Natra T1,它的/tmp 目录已经长到 90%,如果目录满了是否会使系统 运行异常.(因为我们运行的业务不能停,故不能重启 SUN 机器来让系统清空该目 录,也不能直接清空该目录,应为应用程序正在运行.) 下面是一些数据:

    df -k

    Filesystem kbytes used avail capacity Mounted on /proc 0 0 0 0% /proc /dev/dsk/c0t0d0s0 1258491 51942 1143625 5% / /dev/dsk/c0t0d0s6 1612343 500741 1063232 33% /usr fd 0 0 0 0% /dev/fd /dev/dsk/c0t0d0s3 33099 9211 20579 31% /var /dev/dsk/c0t0d0s7 13550703 838475 12576721 7% /export/home /dev/dsk/c0t0d0s5 30743 10319 17350 38% /opt /dev/dsk/c0t0d0s1 548687 369368 124451 75% /usr/openwin swap 627864 563360 64504 90% /tmp

    cd tmp

    ls

    ps_data

    ls -a -l

    total 98 drwxrwxrwt 6 sys sys 443 May 7 15:29 . drwxr-xr-x 22 root root 512 Mar 20 17:45 .. drwxrwxr-x 2 root root 176 Feb 27 23:18 .X11-pipe drwxrwxr-x 2 root root 176 Feb 27 23:18 .X11-unix drwxrwxrwx 2 root root 179 Feb 27 23:18 .pcmcia drwxrwxrwt 2 root root 327 Feb 27 23:18 .rpc_door -rw-rw-r-- 1 root sys 5056 Feb 27 23:18 ps_data

    cd .pcmcia

    ls -a -l

    total 32 drwxrwxrwx 2 root root 179 Feb 27 23:18 . drwxrwxrwt 6 sys sys 443 May 7 15:35 .. prw-rw-rw- 1 root root 0 Feb 27 23:18 pcram

    cd ..

    pwd

    /tmp

    cd .rpc_door

    ls -a -l

    total 32 drwxrwxrwt 2 root root 327 Feb 27 23:18 . drwxrwxrwt 6 sys sys 443 May 7 15:36 .. Drw-r--r-- 1 root root 0 Feb 27 23:18 .rpc_100029.1 Drw-r--r-- 1 root root 0 Feb 27 23:18 .rpc_100029.2 Drw-r--r-- 1 root root 0 Feb 27 23:18 .rpc_100029.3

    cd ..

    cd .X11-pipe

    ls -a -l

    total 32 drwxrwxr-x 2 root root 176 Feb 27 23:18 . drwxrwxrwt 6 sys sys 443 May 7 15:37 .. -rw-rw-rw- 1 root root 0 Feb 27 23:18 X0

    cd ..

    ls

    ps_data

    cd .X11-unix

    ls -al

    total 32 drwxrwxr-x 2 root root 176 Feb 27 23:18 . drwxrwxrwt 6 sys sys 443 May 7 15:38 .. srwxrwxrwx 1 root root 0 Feb 27 23:18 X0 等待您的回答,谢谢

    A: 我认为是系统统计信息错误的, 本人的经验是当/tmp 的使用率超过 10% 时,系统就 变的很慢了。出现这种情况,首先,要检查系统中运行的程序有没有不停分配内存, 却没有释放(指自己开发的程序)。另外看一下系统对/tmp 的 swap 交换情况。使用工 具 sar 和 iostat 都可以看到。关于 sar 和 iostat 的用法, 可以看 man 即可。

    118 Q: 有一用 MOTIF 写的程序,运行之后不能显示中文(乱码),由于显示的信息是 不固定的,故不能使用资源文件.怀疑程序中与创建字体时使用了以下的函数 有关,但注释掉后也一样: font1=XLoadQueryFont(XtDisplay(toplevel), \"--screen-bold-r-normal--12-\"); font2=XLoadQueryFont(XtDisplay(toplevel), \"--screen-bold-r-normal--14-\"); font3=XLoadQueryFont(XtDisplay(toplevel), \"--screen-bold-r-normal--16-\"); fontlist=XmFontListCreate(font1, \"charset1\"); fontlist=XmFontListAdd(fontlist, font2, \"charset2\"); fontlist=XmFontListAdd(fontlist, font3, \"charset3\"); 运行环境是 ULTRA 60 ,Solaris 2.6 ,安装了中文环境。编译环境是 SUN C++ 4.0 。 还怀疑与 LANG 相关,曾试过设置为 zh ,chinese 等也不行,请教此问题如何解决?

    A: 实际上,关于选择字体和字符集可以看这个资料,使 用系统提供的标准工具来从中间找到系统中存在的字体和字体的名称。这个资料在 Answer Book 的 System Administration Collection 中。 实际上,上面的问题不 出现在字体的选择上面, 而是在 MOTIF 中在选择框的使用设置中还要设置一次字体

    119 Q: 请问 SUN 的 E250 以上机器支持 “双机热备 + 磁盘阵列” 的使用方式吗?Ultra 系 列的机器是否也能支持呢? A: SUN 的 E250 以上机器支持 “双机热备 + 磁盘阵列” 的使用方式,可以使用 SunCluster 软件实现;Netrat 系列电信服务器也支持;Ultra 系列的机器,不 在支持的列表中。但是,“双机热备 + 磁盘阵列” 的具体含义应该搞清楚。推 荐的文档在 sun cluster collection 中。

    120 Q: 我在一个 JAVA 程序中打开 50 个 SOCKET 端口,结果出现异常: java.net.SocketException:Too many open files 请问如何解决此问题?谢谢!另外,请问在一个 JAVA 进程中可以同时启动的线 程数是多少?最大线程数受什么限制?能否达到 240 个线程?谢谢!如上问题 如果可以通过修改配置来解决的话,会有什么样的负面影响? A: You have two ways to modify the limit number of files that a process can open simutanously. One: modify the /etc/system file add the following entry: set rlim_fd_cur = #n #n is the number you want. Should be no more than 1024. You should reboot the machine. Two: Use the system command: ulimit $ulimit -n #n Note: You should use B-shell. And using the same terminal session(in the same terminal window) to run the your application program( to guarantee your application process is a child process of the setting terminal.) You can man ulimit to see the detailed usaged. The disadvantage brought by incread the file limite for a process or the whole system is increasing the system memory usage. But, for today\s machine, this disadvantage is not too expensive. (William said:) There is no limit for max open socket number in Java. But the operating system has a limit for max open file descriptors.A socket resource is treated as a file descriptor in Unix. The previous email answered your question. You can try as said.

    121 Q: 我想把一个 HP 平台上运行的 B SHELL 脚本在 SOLARIS 2。6 上运行,但是出现了 问题:要运行的脚本部分: command_count = 0 command_item[$command_count]=check_AutoRaid command_count=expr $command_count + 1 command_item[$command_count] = check_system_resource command_count=expr $command_count + 1 command_item[$command_count]= check_diskspace command_count=expr $command_count + 1 command_item[$command_count]= check_bill_record command_count=expr $command_count + 1 command_item[$command_count]= get_max_CAPS command_count=expr $command_count + 1 command_item[$command_count]= check_DataBase command_count=expr $command_count + 1 command_item[$command_count]= check_netstate_SMP command_count=expr $command_count + 1 command_item[$command_count]= check_work_dir command_count=expr $command_count + 1 command_item[$command_count]= check_dir_OAM command_count=expr $command_count + 1 command_item[$command_count]= check_dir_others command_count=expr $command_count + 1 command_item[$command_count]= check_files_informix command_count=expr $command_count + 1 command_item[$command_count]= check_crontab command_count=expr $command_count + 1 出现的问题: ./scp.sh: command_item[0]: not found ./scp.sh: command_item[1]: not found ./scp.sh: command_item[2]=: not found ./scp.sh: command_item[3]=: not found ./scp.sh: command_item[4]=: not found ./scp.sh: command_item[5]=: not found ./scp.sh: command_item[6]=: not found ./scp.sh: command_item[7]=: not found ./scp.sh: command_item[8]=: not found ./scp.sh: command_item[9]=: not found ./scp.sh: command_item[10]=: not found ./scp.sh: command_item[11]=: not found ./scp.sh: bad substitution

    请问这是否因为平台的问题引起的

    A: I have looked up several documents about B Shell. There is no array definition and usage in original B-shell. It seems like B-shell is expended in HP platform. I think you should modify the source script to make it pure B-shell and then can run in Solaris.

    122 Q: 现在我们有一个特殊的需求,需要在编译时,指定一字节对齐(缺省好象是八 字节对齐的),请问我们使用哪一个编译选项能达到这个目的? A: There are some differences between different c/c++ compiler in their options. Actually, I don\t know so much about the options used in gcc, but I think you can get some documents from the web site http://www.gnu.org. We have detailed document about Solaris C. If you want these documents, you can contact me or get from http://docs.sun.com, in which site you find workshop collection.

    123 Q: 有如下几个问题请帮助解决: 1、solaris 用户登录以后,总是弹出很多控制台窗口和浏览器窗口等,请问: 如何定制用户的登录界面和环境,让其登录后只弹出一个窗口。 2、请问如何再 solaris 上设置 dns? 3、如果想再 solaris 上将固定 ip 方式改为自动获取 ip 的 dhcp 方式,需要修改哪 些文件?而如果将工作站设为 dhcp 服务器,又如何设置?最好是能发一份 solaris 这方面的配置资料,谢谢 A: 1. 删掉不想要的窗口,选择 exit 退出桌面环境,系统提示是否保存当前桌 面,回答是。.

    1. 手边刚好有一本教程,请参照进行配置. dnsconfig
    2. You can create a empty file dhcp.hme0 in /etc directory. If you don\t want to reboot your machine, run the command: # ifconfig hme0 dhcp start

    124 Q: 我们用一台 Netra T1,操作系统为 solaris7,运行一个应用程序。 用 df -k /tmp 查看 swap 空间,发现一些奇怪的现象: 应用程序启动时: 文件系统 千字节 用了 可用 容量 挂接在 swap 1158400 8 1156392 1% /tmp 运行 1 小时后: 文件系统 千字节 用了 可用 容量 挂接在 swap 1158392 8 1158384 1% /tmp 再过一段时间: 文件系统 千字节 用了 可用 容量 挂接在 swap 1158276 8 1158268 1% /tmp 再过一段时间: 文件系统 千字节 用了 可用 容量 挂接在 swap 1158392 8 1158384 1% /tmp 其中,1158400 为 swap 的总空间大小,为什么总的 swap 空间会变化。如果 swap 不断减少 ,总有一天会用完,该怎么办。带着疑惑向您请教

    A: Actually, the sample data in your table look very healthy. Don\t trust so much about these statistics numbers. In fact, if the gloss number of swap file system reduced not big, the system can run well. If the number decrease much, it means a process use a lot of swap space. If you kill the process, the number will increase some.

    125 Q: 在 WinNT 中有任务管理器, 在 Linux 上面有 top 程序, 可以查看一个进程占用 的 CPU 时间,内存,当前运行的线程数等,但是在 Solaris 上面如何查询这些信 息呢? A: There are two ways to see a process\s cpu occuptation.

    1. run the command in a terminal or console: #ps -elf
    2. In cde interface, there is a graphic utility which you can find in tool(or 工具) column

    126 Q: 请问: 设置了一个普通用户,该用户设置有相应的 $PATH 环境变量,用 su 命令 (不 是 su -) 切换到超级用户以后,原来的 $PATH 变量的值发生了改变,导致了应用有 些不正常,请问这如何解决? A: 实际上,使用 su 命令切换到超级用户,环境变量 $PATH 只受文件 /etc/default/su 中 SUPATH 条目的控制。现在,你可以参照此文件对 SUPATH 条 目进行修改即可满足你的要求。

    127 Q: 如果采用 “Cluster” 机制进行双机热备,两台机器之间需要通过心跳线相连 ,请问这些心跳线是如何连接的?也就是说,每台机器有两个网口做心跳侦听, 两台机器间的心跳网线是交叉直接相连,还是可以通过 “Lanswitch” 或 “Hubor” 间接相连? A: 交叉 568a-568b

    128 Q: 我们的程序需要建立很多 socket 连接,但因为操作系统的限制,只能建立有限 的连接。如何修改系统参数,提高操作系统对文件描述符数量的限制。 A: You have two ways to modify the limit number of files that a process can open simutanously. One: modify the /etc/system file add the following entry: set rlim_fd_cur = #n #n is the number you want. Should be no more than 1024. You should reboot the machine. Two: Use the system command: ulimit $ulimit -n #n Note: You should use B-shell. And using the same terminal session(in the same terminal window) to run the your application program( to guarantee your application process is a child process of the setting terminal.) You can man ulimit to see the detailed usaged.

    129 Q: ipcs 命令有没有功能来删除一个共享内存 A: No, ipcs can only print some usage information about shared memory, locks, and semaphores.

    130 Q: 我们的程序需要建立很多 socket 连接,但因为操作系统的限制,只能建立有限 的连接。如何修改系统参数,提高操作系统对文件描述符数量的限制。 A: You have two ways to modify the limit number of files that a process can open simutanously. One: modify the /etc/system file add the following entry: set rlim_fd_cur = #n #n is the number you want. Should be no more than 1024. You should reboot the machine. Two: Use the system command: ulimit $ulimit -n #n Note: You should use B-shell. And using the same terminal session(in the same terminal window) to run the your application program( to guarantee your application process is a child process of the setting terminal.) You can man ulimit to see the detailed usaged.

    131 Q: 请解释一下 solaris 8 有没有 dynamic partition 的概念.是否可以向 windows 一 样动态分区而不用 format 原来的文件系统,谢谢. A: There is no dynamic partition in Solaris 8. Let\s make the conception \"dynamic partition\" clear first. \"dynamic partition\" means

  • Solaris 问答集 at 2008年10月31日

    102 Q: solaris 的问题:激活小键盘上的 Numlock,激活中文输入法,按小键盘上的 0 键,中文输入法自行关闭,请问是何原因? A: You can solve the problem you metioned by trying the following three ways:

    1. Make sure using GB locale, instead of GBK.
    2. Visit http://sunsolve.sun.com to get the \"recommended patches\" package for the your solaris platform, and add it.
    3. If possible, you can change the solaris platform from solaris 2.7 to solaris 2.8

    103 Q: 有关在 SOLARIS 上使用 NETSCAPE 问题 问题描述: 1.在 SOLARIS2.6 上安装 NETSCAP4.04 后,安装提示成功后,运行 netscape,出现以 下错误信息: xlib:connection to \"0.0\" refused by server xlib:client is not authorized to server can\t open display : :0.0 2.在 SOLARIS2.6 上安装 Acroread 后,如何设置能直接点击打开.pdf 文件,而无需 每次要先启动 Acroread,然后再打开? 请问上述问题如何解决? A: 1. You run the command: #xhost :0.0 and then, you can use NETSCAPE In the terminal, in which the netscape is launched, please set the envrionment DISPLAY as :0.0

    1. Actually, I don\t know how to configure it. If you are interested in it. You can read some topics in AnswerBook2 User Collection.

    104 Q: syslogd 如何支持汉字? syslogd 好像会把汉字拆分成两个字节,并去掉高位 如何解决? A: How the background service provider syslogd supports character set depends on the locale environment it starts. So, if you want Chinese characters transferring by syslog. You can restart syslogd in Chinese environment by issuing the following commands:

    LANG=zh; export LANG # set the locale environment in Chinese.

    kill -9 cat /etc/syslog.pid # to kill the former syslogd

    /usr/sbin/syslogd

    If you want syslogd to support Chinese characters whenever the machine boot. Put the attacted file in the /etc/rc3.d directory.Make sure this file\s mode is \"rwxr-xr-x\" and the owner is root.

    105 Q: 我的工作站的交换分区分的太小了,除重装系统外,是否有其它办法将空间调 整一下。 A: You can extend your swap region by issueing the following command: #mkfile -m #swap -a Note: the should be the full path name.

    106 Q: 用 vi 打开一个 script 文件,发现里面有非法字符^M,在 vi 命令行如何全程替代 掉该字符?我试了一下用以下命令来做,却不行:0,$s/^M// A: 1,$s/^M//g ,其中,^M 是 ctrl+V ,ctrl+M,或者,用下面这个命令。 %unix2dos $filename > $newfilename

    107 Q: How to add space to a filesystem in solaris2.5.7 ? When I patchadd a patch,It tell me that there is no sufficient filesystem capacity. A: It seems like your root partition too small. Please check it availiable size. If it is small, I think you would better to reinstall the system. Please store all the data in the disk. In the new installation, you need really to partitions, one is for swap, and another is for /. The swap partition /tmp needs about 200M to 500M. Then all the left should be given to /.

    108 Q: 请教关于 Solaris Patch 的问题。我们在安装一些软件时,经常需要先安装一 些 Patch,有一事不明,向您请教一下,比如某个软件需要 Patch : 107546-02, 现在我的机器上已经安装 107546-08,是不是就不用再安装 107546-02 了 Patch 后面的那部分是什么意思?是不是大的数字可以包含小的数字的功能了? 同一 个 Patch 的不同版本之间会不会有冲突? A: You are right. If you have installed a bigger version of the same patch, it not necessary for you to install the smaller one. The bigger version will override the earlier one if it installed before. You need not worry about any collision.

    109 Q: 关于 sun 的 SunNet 我目前想了解关于 sun 的 SunNet。我从 sun 的网站上了解到 SunNet 已经被合并入到 Solstice 里了,我目前想试着把我做得程序集成到 SunNet 或 Solstice 里,我看了 Slostice 得 White Paper,但里边只提到了一点点 相关得 Api,我从哪里,怎么才能到比较完全得文档呢?

    A: To my knowledge, you can go to the following for a detailed info: http://www.sun.com/software/solstice/em-products/network/sunnetmgr.html.

    110 Q: 关于 SUN 机器 root 口令丢失问题,如何解决? A: 办法如下: 利用 SOLARIS 的启动盘来启动,然后把硬盘 mount 上去,修改硬盘上原 etc 目录 下的 shadow 文件,将 root 项里的 password 域内容删除,变成无密码。然后重新 启动主机,以无密码的 root 登陆后,重新设置 root 口令。具体步骤如下: 1.把你的 solaris 光盘放进 cdrom 2.键入 stop+a 3.当出现\ok\字样时,键入 boot cdrom -s 4.cd /tmp/root 5.mkdir /tmp/root/xxx (xxx 是什么鬼东西就无关紧要了) 6.mount /dev/dsk/c0t0d0s0 /tmp/root/xxx (在这里 c0t0d0s0 是你的 root 盘) 7.运行 csh 8.setenv TERM vt220 9.cp /tmp/root/xxx/etc/shadow /tmp/root/xxx/shadow/shadow.bak 10.vi /tmp/root/xxx/shadow,并且将 root 项里的 password 域删除即可。 11.重启动,你就可以以无密码的 root 登陆了,登录后,更改 root 的密码。

    111 Q: In solaris 2.6. when i use command \"killall\" ,all process started in CDE will be killed and the eviroment will change to CDE login. I looked up the man manual about \"killall\" ,it told me that \"only root can use the command\".But I really use it with common id.In solaris7 and solairs 8, with common id,i can\t use the common.can you tell me why i can execute \"killall\" successfully in solaris 2.6? A: Just see the access mode of /usr/sbin/killall. If you can use it with a common account identity, the access mode should be x-rsx-rx-r. If you can not use it in a common account identity, the mode should be x-r--r--r. You can change the mode as you like, whenever in 2.6, or 2.7 or 2.8.

    112 Q: I downloaded the SDM2.3 from the Download Center of \"www.sun.com\" ,read the White Paper and web detailed describing.But it is only the outlook of the software. I need the detailed document about how to integrated my own network management application to Solstice. A: I transfer this messag to Sun Service in Guangdong.

    113 Q: 请问有没有磁盘管理工具。我们有一台 E450,有 5 块硬盘,想做 RAID,但是没有工 具. A: If the machine\s OS is solaris 2.8, the storage management software is also installed in you machine. You can make the RAID by issuing the command family: /usr/sbin/meta*; If you are not so familiar with these commands. I can do it for you. or you can use solstice disksuite, it is a GUI tool.

    114 Q: 怎样强制更改 NIS 客户端的本地 NIS 数据表?有时候 NIS 客户端和 NIS 服务器端有 时会出现不一致的情况.NIS 服务器和 NIS slave 服务器也会出现这种情况。 A: 你可以用 yppush 和 ypxfr 来做这种工作,更常见的方法是把它们写进 cron,定 期更新,具体步骤请查阅 Answerbook.

    115 Q: 为了将工作站设为从 DHCP 动态分配 IP,并且将主机名由\"unknown\"改为原名 修改了/etc/init.d/rootusr,将 dhcpinfo 后面三行(不是四行)注释掉; hostname=/sbin/dhcpinfo Hostname

    case $? in

    0) [ -z \"$hostname\" ] && hostname=\unknown\ ;;

    2) try_dhcp=no ;;

    esac 重启后,提示: /sbin/rcs:ysntax error at line 143 : \esac\ unexpected INIT:cannot creat /var/adm/utmp or /var/adm/utmpx INIT:SINGLE USER MODE 输入 root 口令后,只能运行在单用户模式,且 vi、ls 等都不能用(#vi:not found) 如何才能打开/etc/init.d/rootusr 文件进行修改,恢复正常状态。 A: 请找一个 SOLARIS 的安装启动盘,使用以下方法可以修改 rootusr 文件,步骤如 下: 1.把你的 solaris 光盘放进 cdrom 2.键入 stop+a 3.当出现\ok\字样时,键入 boot cdrom -s 4.cd /tmp 5.mkdir /tmp/xxx (xxx 是什么东西无关紧要,随便取一个名字,如 test) 6.mount /dev/dsk/c0t0d0s0 /tmp/xxx (在这里 c0t0d0s0 是你的 root 盘) 7.运行 csh 8.setenv TERM vt220 9.vi /tmp/xxx/etc/init.d/rootusr,把 esac 那行也注释掉即可。 10.把 solaris 光盘拿出,reboot,重启动即可。

    116 Q: 一台 Ultra60 工作站,其固定 IP 为 10.11.105.247,用 ifconfig hme0 dhcp start 总是失败,如下所示。

    netstat -a|grep 4999

    ifconfig hme0 dhcp start

    May 7 20:11:11 hwMusa01 dhcpagent[478]: ERROR! Address 10.11.105.147 is already in use ifconfig: internal error in DHCP agent

    netstat -a|grep 4999

    localhost.4999 . 0 0 0 0 LISTEN localhost.4999 localhost.1023 32768 0 32768 0 TIME_WAIT

    抓包发现是 dhcp 服务器 offer 的 IP 地址 10.11.105.147 被 decline 了。手工运行 dhcpagent,提示 4999 端口被使用了。以前此工作站曾配置为固定 IP: 10.11.105.147,但现在已改为 10.11.105.247 并重启过多次。请问,可能是什 么原因导致 dhcp 失败??

    A: 导致问题出现的原因是,由于客户机在申请原来的被保留分配的 IP 时,服务器 发现这个 IP 不能够被使用(已经有其它机器使用了这个 IP 地址)。使客户机申 请失败,并且使其中的某些进程不能正常退出,继续占用了端口 4999 而使后面 的申请不能进行。办法是找到占用端口 4999 的进程,杀掉即可。找到这个进程 的办法是,这个申请进程是带有 dhcp 字样的。

    ps -e | grep dhcp

    会出现一到两个进程号。验证这些进程是否占用了 4999 是看进程打开的文件:

    /usr/proc/bin/pfiles #pid

    早到进程然后杀掉。这样就可以继续启动 Client 端的 dhcp 申请。注意,修改 服务器的设置使新的申请可以成功。

  • Solaris 问答集 at 2008年10月31日

    76 Q: 请问:如何设置工作站的最大客户端数?现有一台测试用机,使用人较多,经 常出现 “无法得到 pty” 的提示。 A: 在/etc/system ,可以用参数 maxusers 设置,最大 2048,如果这里没有设置,默 认为与系统内存容量相同 (以 M 记,最大为 1024),

    77 Q: I install visibroker into my solaris 2.7. When I execute a example program,it cannot execute and tell me: ld.so.1: Server: 致命的: liborb64r_so:打开失败:无此文件或目录 被杀掉

    (Server is my program) Can you tell me how to settle it?

    A: you should set this envirnment variable: LD_LIBRARY_PATH

    78 Q: 贵处有无磁带机的使用手册或指导说明? A: answerbook 中系统管理员手册 I 有使用说明. answerbook 的文档不是 html 格式,需要一个服务器程序转换, 察看本机 http 进 程看有没有下面这个:

    ps -ef |grep http

    /usr/lib/ab2/dweb/sunos5/bin/dwhttpd /usr/lib/ab2/dweb/data

    79 Q: 在 solaris 2.5.1 上 把 系统时间 改为 2004 年,无问题,然后把时间再改回 来后,整个 UNIX 死机,请 SUN 工程师答复. 具体操作为: 将操作系统时间设为 2004年3月1日,然后再将操作系统时间改回当前的时间,则系统的 cpu 资源被两个 进程 dtwm,dtfile 严重占用,X Window 反应非常缓慢,在低配置的系统上导致系统 不可操作.同时显示 \"Warning:selected failed;error code 22. A: 在窗口环境下或多用户模式下来回切换时间,会导致不可预测的结果,所以, 如果当真要执行此类操作,请在单用户模式下进行.

    80 Q: shell 文件中如何从文件中读参数? A: cat yourfile`

    81 Q: 如何分析网络负载,在 SUN 上面有没有相应的工具 A: netstat -i

    82 Q: 请问目前 SUN E250,E450,E3500 支持的 CPU 主频和缓存分别是多少?您能将这 些配置列表发给我吗? A: docs.sun.com 有 硬件的 answerbook ,可以参考一下。 现在支持的 CPU 到 400M, 480M 产品已有.but still have not released

    83 Q: mt -f /dev/rmt/0 有个参数:retension 中文为 “拉紧”,在磁带操作中具体 做什么? A: the man page of this command said it clearly: Rewind the cartridge tape completely, then wind it forward to the end of the reel and back to beginning- of-tape to smooth out tape tension. so ,it is not 拉紧, but 放松 instead.

    84 Q: 具体问题是:有一个进程不停的向该文件增加内容,同时另外一个进程建立了 与该文件的管道,从该文件中读取一行记录进行处理。然后删除该行记录。因 此需要保持该文件 i-node 不能改变,否则,向该文件写的进程就不能将信息写 入该文件了。有没有解决方法,请指教。 A: I don\t know if I have understood you : If you want save this file for later use, you should not remove its\ content,if you don\t need these content, you don\t need this file as well, you can use pipe only, or other interprocess communication methods.

    85 Q: 我用 dos2unix 转换一文件,却不成功,提示信息如下:(我用 PC 机通过 rexec 远 程登陆的) $dos2unix filename1 filename2 could not open /dev/kbd to get keyboard type US keyboard assumed could not get keyboard tyep US keyboard assumed

    请问此问题是怎麽回事?如何解决? A: 权限问题, 检查一下 /dev/kbd 读写权限

    86 Q: 我希望在一台 ultra 机器为以下网络配置路由 子网:10.1.0.0 掩码:255.255.0.0 网关:10.220.10.113 应该如何配置? 用以下命令可以吗?如果永久配置需要修改那些文件? %route add 10.1.0.0 10.220.10.113 A: no,try this commond: #route add default 10.220.10.113

    87 Q: 有个 patch 107311-09,能解决 CC4.2 不能处理 #pragma pack() 的问题吗? A: the right patch is 104631, but you should add all related patch to avoid other problem,find them at: sunsolve.sun.com

    88 Q: 在 CSH 下我输入以下命令? $setenv IWAVE \pwd\ $echo $IWAVE 结果显示为:pwd 在我的理解中应该是将 pwd 的输出(如/tmp)赋值给变量 IWAVE,所以我想象的 输出是/tmp A: use ` instead \ apparently,they are different. read some unix books for reference

    89 Q: 为什么有时普通用户不能登录 CDE? A: 这个错误可能是由于 CDE 的不正确设置造成的。在每一个用户的 home 目录下有一 个.dt 子目录.在此目录下有一个 errorlog 文件记录了 CDE 登录失败的原因.查 看此文件可以找到失败的原因.一个可行的方法是:使用 root 登录并且删除对 应用户 home 目录下的.dt 目录,同时可以删除/.dtprofile 文件, 然后使用 用户口令登录即可.外检查/usr/dt/bin/dtsessoin 的使用权限.正确的权限应 当是-r-sr-xr-x

    90 Q: 关于 Solaris8 上 DHCP 的配置问题安装 Solaris8 后,进程 dhcpagent 的 CPU 占用率一 直都超过 88%, 请问有什么方法可以解决.谢谢. A: I solve this program by going to the field sit. The update period parameter can not be set longer than 2 weeks in the DHCP server side.

    91 Q(1)能否在 Ultra60 上只安装 64 位的 Solaris8? (2)Solaris8 安装在 Ultra60 上,内核是 32 位还是 64 位? (3)在其上安装的 Oracle 8 是安装的 32 位版本还是 64 位版本? A: Solaris8 的内核是 64 位的, 但是,它同时带有 32 位程序的解释器,也就是说 32 位 的程序也可以在 Solaris8 上面运行。事实上 Solaris8 上面有一些系统命令就是 32 位的程序,如 link 等。所有的 Solaris8 都是 64 位的,但是都带有 32 位的解释 器。(就现在的情况而言,32 位的解释器是必 须的)。在 Solairs 8 上面运行 的应用程序可以是 64 位,也可以是 32 位的,包括 Oracle 8 在内

    92 Q: 很感谢你的答复。原来不能创建用户的原因应该是文件系统已满,我删除了一 些用户账号后,创建正常。现在的问题是 c0d0t0s0 文件系统的容量太小,现在 已经达到 100%,如何扩展这个文件系统,是否只有重装系统这一个办法? A: 在系统安装时,各个分区划分的有些不太合理。/ 目录和 /usr 太小 /export/home 和/tmp 太大。实际上在安装时,比较合理的办法是只设置 / 和 /tmp,/tmp 最多 500M 即可。然后在 / 上面建立/usr,/opt 和/export/home。 现在补救的办法是利用软 link 的办法:首先将一些在/或/usr 中不太是系统直接 使用的目录 (一定不可以包含/usr/sbin,/sbin, /etc,等等)转移到有空间的分 区上面,然后使用 ln 建立软连接。关于 ln 的使用可以 man.这种办法是不得已而 为之。不是很好把握,搞不好就会死机,并且启动不起来。所以在进行此项活 动时,首先要备份数据,以免发生以上情况时丢失。如果您在下午下班的时间 可以抽出一点时间,最好还是将系统重新安装一遍的好。因为,每一个目录都 有一定的用意,一些软件的安装不是地方会让人感到很别扭。而使用软连接又 会降低系统的运行速度。

    93 Q: 求助 -- 请教一个多线程编程问题。关于我们发现的问题具体现象如下: 函数 void* A(void *pInput) { char szBuf[30000]; //this buffer maybe larger than 30,000 ... ... } 在多线程程序中,该函数在 main 中运行(此时相当于在主线程中运行)正常。 如果使用 pthread_create 创建一个线程,以 A 作为线程入口函数,用内存测试工 具 purify 可以观察到该线程运行过程中出现 Beyond Stack Read、Beyond Stack Write 错误。如果把 szBuf 改为堆中分配的内存,则无此问题。据此,我们判断 是线程的栈空间溢出造成该问题。按资料描述,主线程的缺省栈空间大小为 8M ,子线程缺省栈空间为 2M;我们使用 pthread_attr_setstack 函数将子线程的栈 空间设置为 8M,但仍未解决问题。后又将线程属 性设置为 PTHREAD_SCOPE_SYSTEM, 问题仍然存在。函数 A 以静态库方式由第三方提供, 我们现需要使之在一个子线程中运行,因此希望能够提供主线程与子线程差异 的资料,除堆栈空间、调度方式外,是否还有其他差别,造成以上错误的发生 A: In fact, there is no problem in the program. I think there is a bug in their debug tool: purify. You can use dbx to debug your program.

    94 Q: 请问一块硬盘上可以有两个 Solaris 分区吗?在一块硬盘上分了两个 solaris 分 区,一个是 active 的系统安装分区,另一个是后来用 fdisk 创建的,请问怎样把 第二个分区加入到 solaris 系统中使用。谢谢。 A: Yes, There can be up to six partitions in a disk. you can see the partition using utility format. Command list: #format Then you will see the disks installed in you system.then select the disks you are interested in. then print \"partition\" and then \"print\" to see the partition information. The partition you want to add to the system can be identified as c#t#d#s#. Make sure the mount point( a empty directory in file system). such as /disk1.then run the command: #mount /dev/dsk/c#t#d#s# /disk1

    run the command #df -k to verify the slice(partition) is properly installed. 95 Q: 请问在 Solaris 2.7 上,可以动态改变分区大小吗? 我的工作站划分分区不合理, 根分区太小,已经满了,可以使用工具动态改变吗? A: No, If you want to modify it, the whole disk data will be lost. In fact, I think it high time for you to re-instal the solaris system. In the new installation. You really need just two partitions swap and root. Leave no more than 1G to swap partition and all the left to root.Don\t forget to backup all you data before re-installation.

    96 Q: 用 CC 编译器如何实现结构成员按字节对齐,类似于其他编译器的 #pragma pack(1) 功能。 A: It is a standard compilation option(#pragma pack). It is also supported in Solaris C.You can get documents about SC options from http://sunlibray under workshop directory.

    97 Q: 为什么 SUN 的本地界面有时候会出现死掉的情况,此时 kill 掉用户的 dtsession 是否就可以恢复正常。如不能恢复正常还需要做那些操作。 A: In my experince, the interface dying, may be caused by other application other than dtsession. You should determine which program\s interface causes the interface dying. This situation is not often happens, and most of them happened when you are manipulating a program\s interface by mouse. When it happen, login the system from network as \"root\" or the account which cause the dying, kill the program.

    98 Q: 系统不能启动, 任何二级目录都没有了,但用户下,所有命令都不能用,怎么 安装 Solaris,能直接从光盘启动吗? A: You harddisk is damaged. It may be salvaged manually, or can not. You should restall the system. Or even worse, you should change your harddisk.

    99 Q: Can you tell me if I want to add a new CPU chip to a only one CPU chip machine on solaris system,Can the application run continually in the old cpu chip without interruption on solaris system ? A: Please tell me the machine\s type. If your machine is a workstation. CPU chips can not be added without turning down the power. I don\t know so much in this field. But, I have forwarded this message to the specitest in our company. You will get much more detailed answers. But you should wait several days. Another way for you is to consult the vender who sell you the machine directly.

    100 Q: what\s deference between the processor_bind() and pset_bind()? A: You can get the differences between two functions by seeing the manual:

    man processor_bind

    man pset_bind

    101 Q: 我们有一个产品在移植到 SOLARIS 的过程中出现了大量难以理解的问题,请给 我们现场支援一下,非常感谢!使用 Forte Develop6 编译 C++ 程序的时候出现 以下信息:

    \"mit/../teglobal.h\", line 39: Warning (Anachronism): Attempt to redefine TRUE without using #undef. \"mit/../teglobal.h\", line 40: Warning (Anachronism): Attempt to redefine FALSE without using #undef.

    Assertion: (../links/prepexpression.cc, line 65) while processing mit/multilock.cpp at line 0.

    请问是什么意思,难道编译器还要 assert 吗? A: CC 编译器要求被编译的文件以两个新行结束,请在相关头文件末尾加上新行。

  • Solaris 问答集 at 2008年10月31日

    47 Q: 1.问题描述:Router&LanSwitch 的日志管理依赖系统的 syslogd 进程来实现。 通过设置/etc/syslog.conf 文件, 可以控制 syslogd 把日志存入特定的文本 文件中。然后日志后台就可以周期性的轮询这些文件并导入数据库。按照 sun 的 man 页说明,当向 syslogd 进程发 HUP 信号时,进程将重读配置文件 /etc/syslog.conf,然后继续运行。 但在 Solaris2.7 以下实际的效果是:发 HUP 信号将导致 syslogd 进程不能正常工作(有的试验结果是,信号导致进程 终止),后续设备日志全部丢失。 2.解决建议: 我们的建议是,修改系统的脚本文件/usr/lib/newsyslog,不让其向 syslogd 发 HUP 信号,而是 TERM(终止信号),然后重启。此种方法的弊端是,如果用 户主动向进程发 HUP 信号,仍然存在问题。而且也不能解决 syslogd 意外退出 的情况。第二种建议是由综合统一做一个检测进程,这样各项目就不会产生 冲突。但仍然存在用户主动向进程发 HUP 信号使 syslogd 失效的问题。由上述 可以看出,无论何种方法,都不能彻底解决问题。 A: 问题的产生可能是由于程序员定义了新的日志文件并企图 使用 newsyslog 脚 本来处理,这个脚本备份日志文件再发送 HUP 信号。newsyslog 脚本在处理系 统文件时不会有问题,很可能是由于 syslogd 对这些文件做过专门的处理。但 不能认为我们自己的文件也会得到同样的照顾,事实上,这样做通常是危险 的。 我认为建议 2 是可行的, 因 syslogd 打开的是新的日志文件,不会发 生异常。而用户发送的 HUP 命令只是使 syslogd 重读 syslog.conf 文件 ,也不会发生意外.为了比较好的定位问题,建议在一个比较干净的系统上进 行测试,在测试之前最好停掉自己的程序,

    简化/etc/syslog.conf,我是这样测试的:

    /usr/lib/newsyslog

    logger -p deamon.notice \"12345\"

    cat /var/adm/messages

    kill -HUP cat /etc/syslog.id

    logger -p deamon.notice \"aaaa\"

    cat /var/adm/messages

    结果正常.

    48 Q: Solaris 8 中,为什么不可以用如下命令给网卡增加逻辑地址? ifconfig hme0:1 xxx.xxx.xxx.xxx up A: Solaris 8 对 ifconfig 作了一些改动,在这个命令之前,先执行下面的命令就可 以了: ifconfig hme0:1 plumb

    49 Q: 为什么 Solaris 中的多个网卡显示的以太网地址都是一样的? A: 缺省情况下,系统使用本机的 MAC 地址作为各网卡的 MAC 地址,可以用如下 OpenBoot 命令让系统使用网卡自带的 MAC 地址. ok setenv local-mac-address? true

    50 Q: 如何在一台机器里如何实现用多块网卡容错? A: Solaris8 新增了一个 daemon 叫 mpathd 将网卡管理分组管理来完成这样的功能. 原理是给每个网卡分配两个地址,多出的一个逻辑 IP 地址由 mpathd 用来检查个网 卡的工作情况.下面一两块网卡为例介绍配置过程,这里两块网卡分别是 hme0 和 hme1,

    1. ifconfig hme0 group test ifconfig hme1 group test
    2. ifconfig hme0 addif 19.16.85.21 netmask + broadcast + -failover deprecated up ifconfig hme1 addif 19.16.85.22 netmask + broadcast + -failover deprecated up
    3. 检查 hme0:1 和 hme1:1 看是否有逻辑 IP ifconfig hme0:1 ifconfig hme1:1 这里要注意,给网卡增加的逻辑 IP 应当与实际分配的 IP 地址在同一个网段并 且不能与网上其他主机 IP 地址冲突.

    51 Q: 一个进程里最多可以打开多少文件? A: 操作系统为每个进程维护一个所打开文件的数组,进程能够打开的文件与此数组 的大小有关.此数组的大小由两个系统变量限制: rlim_fd_max , rlim_fd_cur, 这两个变量可以用 limit 或 ulimit 命令察看和修改,要扩大 rlim_fd_max 需要 root 权限,rlim_fd_cur 不能超过 rlim_fd_max. 编程时则有库函数 getrlimit 和 setrlimit 可以使用. 另外一种改法是在 /etc/system 文件中修改. 如果是 调用 stdio 函数打开文件,则还有另外一种限制,32 位内核 Solaris 的 FILE 结构 中的 文件句柄是一个字节,所以同时打开文件的上限是 256

    52 Q: 如何改变登录 CDE 时的语言环境? A: 修改/usr/dt/config/Xconfig 文件中的变量 Dtlogin*language 即可.

    53 Q: 如何防止用户通过 CDE 环境中的 suspend 菜单关闭计算机? A: 修改 /usr/openwin/bin/sys-suspend 的执行权限就可以了.

    54 Q: 我安装完 solaris5.7 之后(安装时选择简体中文),运行 C 语言编译器 cc 不成功 ,提示 “language optional software package not installed.”。请问这是 怎么回事,该如何解决? A: Solaris 本身带有 adb,mdb,make 工具,但不带 C 语言编译器.若要使用需要单独购 买软件包及 license.

    55 Q: 想修改 ROOT 的缺省 PATH,在哪改?不要告诉我 LOCAL.PROFILE,不管用. A: 如果以 root 用户身份登录或者用 su - 命令进行切换,则修改 home 目录下 .profile 是管用的. 如果是简单的 用 su 进行切换, 则系统保留除 PATH 之外 的所有环境变量, PATH 被设为 /etc/default/su 中的 SUPATH ,缺省时为 /usr/sbin:/usr/bin

    56 Q: 问一下,现在在 Solaris 下有什么比较好的测试程序语句以及条件覆盖率的工具 A: prof 和 gprof 都有. 如果您使用 workshop 或者 Forte 6.0,则其中有 performence analysis tools 可以使用.

    57 Q: 怎么样让系统启动时就自动在一个网卡上绑定两个 IP 地址 A: 创建文件 /etc/hostname.hme0:1,其中写上第二个 ip 地址.

    58 Q: Sun solaris7 系统中有一下几种 SHELL,sh,csh,ksh,另外还有一个 jsh. 我的问题是:jsh 是什麽 SHELL?另外有 bash SHELL 吗? A: jsh 就是 sh, 只不过是激活了 job control 模式. 但现在 sh 本身就有 job control 功能,所以只用 sh 就可以了. bash 是 sh 的增强, 如果你的系统没 有这个 shell, 可以到 [url]www.sunfreeware.com[/url] 下载. ls /bin/*sh 可以看到系统所有存在的 shell.

    59 Q: 我的光驱无法读取光盘?且总是显示设备忙,如何搞定?mount 显示没有被 mount. A: 查找进程 vold 并将其杀死,就可以手工打开光驱.

    60 Q: 如何将 root 用户的 shell 改掉,我知道一般用户可在 admintool 下修改,但 root 用户不能。 A: 1. chmod 666 /etc/passwd (一定要让普通用户有些权限,切记!)

    1. vi /etc/passwd(最后一个字段试 root 的 shell,要确保该程序存在方可改 掉它. )

    自:BBs.77169.com

    黑客同盟论坛欢迎有热情、有抱负、有时间的会员加盟华盟在线管理!

    我是中国人,我深深的爱着我的祖国,只要祖国需要我会献出我的一切,包括我的生命---------紫色焰火 顶端 主题:Re:转贴:solaris 问答集 (沙发:1 楼) [紫色焰火] 该用户目前不在线 发表于 2005-09-17 21:22 查看作者资料 发送短消息 级别: 六星会员 精华: 35 发帖: 867 威望: 1989 点 华盟币: 2915 个 贡献值: 0 点 好评度: 1 点 软件认证: 0 点 在线时间:324(小时) 注册时间:2004-05-16 最后登录:2007-01-05 [引用][回复][编辑]

    61 Q: 我在安装 Solaris 8 时启用了 DHCP,现在我的主机名是 unknown,在启动时工作 站启用 DHCP 并分配 IP,主机名也自动改为 unknow。请问怎样改主机名? A: DHCP in Solaris8

    1. # touch /etc/dhcp.hme0,hme0:请用相应的网卡设备名;
    2. 修改/etc/init.d/network,/etc/init.d/inetsvc 先备份 # cp /etc/init.d/network /etc/init.d/network.org # cp /etc/init.d/inetsvc /etc/init.d/inetsvc.org 修改/etc/init.d/network 第 278 行: \"dhcp\") #hostname=/sbin/dhcpinfo Hostname hostname=cat /etc/nodename 修改/etc/init.d/inetsvc 第 168 行: hostname=/sbin/dhcpinfo Hostname if [ -z \"$hostname\" ]; then #hostname=\"unknown\" hostname=cat /etc/nodename fi 修改/etc/init.d/inetsvc 第 82 行: if [ \"$_INIT_NET_STRATEGY\" = \"dhcp\" ]; then #dnsdomain=/sbin/dhcpinfo DNSdmain dnsdomain=cat /etc/defaultdomain else dnsdomain= fi if [ -n \"$dnsdomain\" ]; then #dnsservers=/sbin/dhcpinfo DNSserv dnsservers=cat /etc/dnsservers 修改/etc/init.d/inetsvc 第 220 行: /usr/bin/mv /tmp/hosts_clear.$$ /tmp/hosts.$$ mydomain=cat /etc/defaultdomain echo \"${ipaddr}\t${hostname}\t${hostname}.${mydomain}\t# Added by DHCP\" >>/tmp/hosts.$$ 在/etc/init.d/inetsvc 第一行加入如下语句: if [ -f /etc/dhcp.*[0-9] ]; then _INIT_NET_STRATEGY=\"dhcp\" export _INIT_NET_STRATEGY fi 3.创建/etc/defaultdomain,内容为 huawei.com.cn 4.创建/etc/nodename,内容为你的机器名 5.创建/etc/dnsservers:129.9.111.100 10.15.1.3

    62 Q: 我用 msgget 建一消息队列: ret = msgget(IPC_PRIVATE, (0660)|IPC_CREAT); 在一个线程用 msgsnd 发消息,另一个 msgrcv 收: ulReturnCode = msgsnd( QueueID, pBufferAddr, 8 ,IPC_NOWAIT); 当消息队列中的消息个数等于 40 时(每个消息尺寸为 8 字节),msgsnd 函数返 回-1,errno= 11,请问是什么原因。是消息队列满吗?怎样调整系统参数,使 消息队列能大些。 A: msgmap : 100 maximum size of resource map for messages msgmax : 2048 maximum size ,in byte, of a massages msgmnb: 4096 maximum number of bytes on a message queue. msgmni: 50 maximum size of message queue identifiers. msgssi: 8 message segment size. msgtql: 40 maximum number of message headers msgseg: 1024 maximum number of message segments.

    msgseg 最大为 32k, 其他参数最大值都是 2 billion.

    63 Q: license server 如何启动? A: run /opt/SUNWste/bin/lmgrd.ste 可启动 license server

    64 Q: 在 Solaris8 下,如何修改一个目录的大小。安装时系统自动的设置 /export/home 目录空间很大,而其他目录空间很小。 A: 1, 备份 /export/home,

    1. umount /export/home,
    2. 用 format 修改盘片大小,
    3. 备份要增大的目录, 5, umount
    4. 用 format 增加盘片大小.
    5. 重新 mount.

    65 Q: 请问用什么命令可以确定是否有磁带设备?多谢。 A: 看一下 /dev/rmt 如果是空就没有. . 66 Q: 在 solaris 8 下安装 Forte Developer 6 到达: installing Forte C++ Entep Ed 6/SPARC installing Forte Developer 6 时死掉应如何解决 A: 在安装之前,应当清除所有以前安装时添加进系统的 package. 另外,不用缺省目录 /opt , 换一个新建的空目录也有效.

    67 Q: Forte c/c++ 版本可以用在 solaris2.6 操作系统上吗? A: 可以

    68 Q: 在输入用户名后启动很慢,有时甚至进不了,停在启动画面,不知如何解决 (我用 过 fsck,也不好使,有没有更好的办法)! 能否重装操作系统,而不影响现有的已装 软件.谢谢! A: 一般说来, 这与家目录下配置文件有关.新建一个用户试一试.

    69 Q: 现在远程维护的解决方式是通过 Modem 拨号,建立连接,通过我们自己编写的 IP 代理转发程序,完成对传输设备远程维护。在 PC 机上的拨号网络,拨号程序运 行都比较正常,对连接速度,稳定性方面目前使用还算可以。但是在设置 Sun 工 作站的拨号程序的时候,我常常会遇到一些 “奇怪” 的问题, 比如 Modem 不握 手,没有拨号音等。现在我们的拨号设置是自己编写的脚本文件方式。可能对 各种情况考虑的不全面,因此请问是否有相应的软件包(程序)可以帮助我们 机型拨号设置,保证拨号成功? A. 连接失败通常与配置参数有关,由于硬件种类繁多,很难保证一个程序在所有的 硬件环境下都能顺利配置成功.我们只能针对具体情况进行分析.但我们发现,改 变串口的流倥方式经常有助于问题的解决.Sun solstice 中有一个拨号软件据 说比 aspppd 更容易使用,我没有用过,或许您愿意试一试?

    70 Q: 我这多线程程序,我用 ftime 得到函数的调用时间,发现在一个线程中,增加一 个 printf 后,调用时间为 5 毫秒。去掉这个 printf,调用时间却为 15 毫秒。增加 了一个 printf 为什么后使该函数的执行更快了? A: ftime 得到系统当前时间,但具体到线程的执行时间,是和系统的调度情况有关 的, 请用调试工具来检查准确的执行时间.

    71 Q: 我们的技术支持人员遇到一个问题,向您请教:在安装时没有选择安装网络, 现在需要安装网络,怎样增加一个 interface。目前只有 lo0,没有 hme0。 A: 在 /etc 下 touch 一个空文件 hostname.hme0, 用 boot -r 命令重起.

    72 Q: 在 Sun Ultra 5 工作站 (安装 SOLARIS 2.6),每次开机时,都出现以下问题: Restoring the system.Please Wait ... cpr_read_bitmap:Can\t cpr_alloc bitmap0 Can\t read statefile bitmap,please reboot Program terminated {0} OK

    每次开机都需要 boot 才能进入。 请问如何解决? A: 首先, 在 ok 状态下检查 boot-file 参数: printenv boot-file 如果是 boot-file = -F cprboot 之类, 用如下命令: set-default boot-file 再检查一下.应该是空才对. 如果不是, 则需要设置: setenv boot-file -F ufsboot 重新启动.

    73 Q: 经实验,两台 Sun 工作站之间通过网络发 Syslog 日志,也不支持汉字,该问题可 能是 syslogd 的问题。 A: 估计是由于 syslogd 在望上传输时丢掉了字节的最高位.

    74 Q: 如果需要 ID:105181-15 的 patch,请问 ID:105181-19 可以代替吗?ID 毫最好两位 是不是 patch 的版本号,如果是版本号有没有前项兼容性? A: 可以, 后两位表示同一 patch 的版本号.

    75 Q: 以下代码在 Forte C++ 下导致编译错误,请问如何解决?

    template void testimpl(int i1, int i2, p1* n1 = 0, p2* n2 = 0) { p1* pReq = new p1; p2* pRsp = new p2; } void test() { int i = 0; int j = 0; testimpl( i, j); } A: 请下载新的 patch 更新 Forte C++