5.29.2006

Changing foreground / background colors in WRQ Reflection from connected host programmatically

Changing foreground / background colors in WRQ Reflection from connected host programmatically.


Sample perl source: also see /usr/local/bin/*.pl

#!/usr/bin/perl -w

# /usr/local/bin/prodcolors.pl

# Changes colors of foreground/background to: black/white respectively


use warnings;

use strict;


my $code="\e&o2GSub Main

With Application

.SetColorMap rcPlainAttribute, rcBlack, rcWhite

End With

End Sub\e&oH";


print "$code";



<ESC>&o2G Sub Main

Dim c As Integer

c = Val(InputBox$("Enter the sales amount:"))

MsgBox "Your commission is: " & c

End Sub<ESC>&oH



Reflection Basic:

Syntax: object.SetColorMap Attribute, Foreground, Background


.SetColorMap rcInverseAttribute+rcBlinkAttribute, rcGrey, rcBlue

or

.SetColorMap rcPlainAttribute, rcGrey, rcBlue


Attributes:

rcPlainAttribute

rcBlinkAttribute

rcInverseAttribute

rcUnderlineAttribute

rcBoldAttribute (for UNIX and Digital hosts)

rcHalfbrightAttribute (for HP hosts)

rcFunctionKeys (for HP hosts)

rcHotspotAttribute

rcCursorAttribute


Colors:

rcWhite

rcGrey

rcRed

rcBlue

rcGreen

rcYellow

rcCyan

rcMagenta

rcBlack

rcDkGrey

rcDkRed

rcDkBlue

rcDkGreen

rcDkYellow

rcDkCyan

rcDkMagenta

To open/add Reflection Basic macros menu:

Under the Setup menu, click Menu. Then add the Script menu from the "Additional Items/Items from version 6.x" tree to the current menu.


Reflection tech references:

How to Send Reflection Commands from the Host

http://support.wrq.com/techdocs/1223.html


Index of Reflection Scripting Technical Notes

http://support.wrq.com/techdocs/9993.html


Other very good references are the manuals/help files in:

C:\Program Files\Reflection\Manuals and C:\Program Files\Reflection\Help\Enu

rbrwin.hlp - Reflection Basic (scripting) Help


HP-UX CIFS (samba server) implementation

CIFS implementation on HPUX box:


Custom made mount at startup files:

/sbin/init.d/mntcifs

/etc/rc.config.d/mntcifs

/sbin/rc2.d/S910mntcifs

/sbin/rc1.d/K105mntcifs



CIFS Client configuration file:

/etc/opt/cifsclient/cifsclient.cfg


log files:

/var/opt/cifsclient/debug


test kerberos ticket:

/opt/cifsclient/bin/cifsgettkt -s windowsbox1



To mount:

$ mount -F cifs buildsys:/source /home/devl/source

To unmount:

$ umount /home/devl/source



mount -F cifs "windowsbox1:/php share" /cifs_mounts/windowsshare

umount /cifs_mounts/windowsshare



cifslogin windowsbox1 myusername

cifslogout windowsbox1


cifslist -A lists servers with shares and mountpoints

cifslist -U lists users in database

cifslist -M lists mounts in database

cifslist -S lists connected servers

cifslist -s <server> lists shares open at server

cifslist -u <server> lists users logged in at server

cifslist -m <share> lists mountpoints for share


5.28.2006

clone and Oracle 9i DB

Clone an Oracle 9i database:

In source DB:

  • ALTER DATABASE BACKUP CONTROLFILE TO TRACE AS '/b1/mytracefile.trc';

  • shutdown immediate


  • Copy data files and redo logs to clone location. aka:

    • for id in 01 02 03 04 05 06 07 08 09 10 11 12

    • do

    • mkdir -p /u${id}/mydb1 ; chown -R oracle:oinstall /u${id}/mydb1 ; cp -p -r /u${id}/prevea2/* /u${id}/mydb1

    • done

  • Copy source db's init{SID}.ora file to init{newSID}.ora ( usually in $ORACLE_HOME/dbs )


In trace file created earlier:

  • Remove second half of file (starts at the section: "Set #2. RESETLOGS case")

  • Remove all comment lines (they begin with #)

  • Remove blank space between -- STANDBY LOGFILE and DATAFILE

  • At top insert: connect / as sysdba

  • Change line: startup nomount to: startup nomount pfile={location of new cloned init file}

  • Change ALL file references from source db location to new clone location.


In the init{newSID}.ora:

  • Change ALL file references from source db location to new clone location.


  • export ORACLE_SID={newSID}

  • Create a new password file: orapwd file=$ORACLE_HOME/dbs/orapw{SID} password=sys entries=1

  • sqlplus /nolog

    • sql> @/b1/mytracefile.trc

    • You'll see 2 message, these are OK to ignore:

      • ORA-00283: recovery session canceled due to errors

      • ORA-00264: no recovery required

    • Test the database: select count(1) from v$database;

    • alter database backup controlfile to trace as '/b1/newtracefile.trc';

    • shutdown immediate


  • Delete all control files in the clone location: *.ctl example:

    • confirm with - find /u[0-9][0-9]/{clonelocation} -name "*.ctl"

    • then delete - find /u[0-9][0-9]/{clonelocation} -name "*.ctl" -exec rm {} \;


In the newly created trace file:

  • Remove second half of file (starts at the section: "Set #2. RESETLOGS case")

  • Remove all comment lines (they begin with #)

  • Remove blank space between -- STANDBY LOGFILE and DATAFILE

  • At top insert: connect / as sysdba

  • Change line: startup nomount to: startup nomount pfile={location of new cloned init file}

  • Change line: create controlfile to: create controlfile set database "{newDBname}" resetlogs noarchivelog

  • Change line: alter datbase open; to: alter database open resetlogs;


In the init{newSID}.ora :

  • change the db_name, instance_name, service_names, dispatchers parameter to the new DB name.

  • sqlplus /nolog

    • sql> @/b1/newtracefile.trc

  • confirm updated dbname: select * from v$database;



for name in arch audit bdump cdump create pfile udump

do

mkdir -p /u02/srcdb1/${name}

done


for id in 01 02 03 04 05 06 07 08 09 10 11 12

do

mkdir -p /u${id}/srcdb1 ; chown -R oracle:dba /u${id} ; chmod -R 775 /u${id}

done

HP-UX EMS config / tips

HPUX config and tips:

The Event Monitoring Services are a part of the Online Diagnostics. This part is also called HW-Monitoring. The HW-Monitors watch for the Hardware and report via different notification channels to the user or sysadmin.


The Hardware monitors are divided into Event and Status monitoring.

Run the Hardware Monitoring Request Manager by typing:

/etc/opt/resmon/lbin/monconfig

This tool is stored in /etc/opt/resmon/lbin and has only a character interface. After installation of Event monitoring there are some monitors already configured.


The GUI to configure Hardware Monitor request is used with SAM. When SAM is started there is a entry Resource Management. This entry shows a new submenu with an entry like Event Monitoring Service. This will start the GUI interface.

1 custom hardware Event monitoring request: All events (hardware problems) from all monitors will be sent to the pager group (see /etc/mail/aliases) this is done via monconfig. The Status monitoring requests are configured via SAM (Resource Management/Event Monitoring Service) or via the following command: /opt/resmon/bin/emsui /opt/resmon/bin/EMSconfig.ui The only things that can be monitored via this GUI are: filesystem space available status events and number of jobs in job queues JobQueues status events. We are: monitoring number of jobs in job queues and available MB on filesystems if below 70MB.



• Files Installed - EMS Bundles:

EMS-Config.EMS-GUI, EMS-Core.EMS_CORE

/opt/resmon/..

/etc/opt/resmon/..

/var/opt/resmon/..

• Startup scripts:

Starts EMS persistence client: /sbin/init.d/ems

based on config file: /etc/rc.config.d/ems

Starts the EMS SNMP subagent: /sbin/init.d/emsa

based on config file: /etc/rc.config.d/emsagtconf

• EMS Daemons started:

At system boot:

Persistence Client: /etc/opt/resmon/lbin/p_client

EMS SNMP subagent: /etc/opt/resmon/lbin/emsagent

At configuration time upon client connect:

Registrar: /etc/opt/resmon/lbin/registrar


p_client (persistence client) is started by init (1M), and respawned by init if it dies.

p_client checks for dead monitors and restarts them (and any outstanding monitoring requests). Default interval is every 2 minutes (interval set in /etc/opt/resmon/config)

p_client runs at system startup to restart monitors and any outstanding monitoring requests

For EMS configuration problems, refer to:

/etc/opt/resmon/log/client.log

For EMS monitor problems, refer to:

/etc/opt/resmon/log/api.log

For EMS framework problems, refer to:

/etc/opt/resmon/log/registrar.log



These three files are the most interesting files from EMS. But there is also the default log file/var/opt/resmon/event.log. This file will be used for HW Monitoring and default

Notification if Text file is used.

The three logfiles will grow and when they reached about 500kB then they are automatically

moved to <logfile>.old. If the logfile is increased to 500kB it will be moved again.




fbackup optimal config file

For HP-UX, fbackup is very slow on new drives like a DLT4 drive.  So use a config file with the following settings to get the fastest backup results.  See the HPUX man page for fbackup:
http://docs.hp.com/en/B2355-60127/fbackup.1M.html

Here are my recommendations:
blocksperrecord 256
records 32
checkpointfreq 1024
readerprocesses 6
maxretries 5
retrylimit 5000000
maxvoluses 200
filesperfsm 2000

blocksperrecord, checkpointfreq, and filesperfsm are the key vlaues to be concerned with.

restricting ftp access on HPUX

HP-UX:  how to restrict access to ftp

See man pages for: ftphosts and ftpaccess

/etc/ftpd/ftphosts contains the username and possibly the hostnames that are allowed to connect via ftp on our HP box.


default config files on HP-UX

Looking for default (factory delivered) copies of configuration files in HPUX:

/usr/newconfig .... subdirs underneath


kerberos integration with Active Directory(2000) on HP-UX

This is what I did to setup our HP UX11i box with Kerberos integration with AD


  1. create a service type user account in AD. In the case below the username is: kermit

  2. Run the ktpass command on a domain controller using the syntax below.

  3. Copy the krb5.keytab file to the HPUX box under /etc/krb5.keytab

  4. Edit the /etc/krb5.conf file, pointing to the correct domain and domain controller.



ktpass utility is included in the Windows 2000 support tools.


On domain controller:

E:\>ktpass -princ host/amisys@MYDOMAIN.COM -mapuser kermit -pass ***** -out krb5.keytab

Successfully mapped host/mybox to kermit.

Key created.

Output keytab to krb5.keytab:


Keytab version: 0x502

keysize 49 host/mybox@MYDOMAIN.COM ptype 1 (KRB5_NT_PRINCIPAL) vno 1 etype 0x1 (D

ES-CBC-CRC) keylength 8 (0x10ade54f832551ba)

Account has been set for DES-only encryption.


copied krb5.keytab to /etc/krb5.keytab and set owner: root:sys and permissions: 600


copied pam.krb5 to /etc/pam.conf


Setup Kerberos config file:

[libdefaults]

default_realm = MYDOMAIN.COM

default_tgs_enctypes = DES-CBC-CRC

default_tkt_enctypes = DES-CBC-CRC

ccache_type = 2


[realms]

MYDOMAIN.COM = {

kdc = camelot.MYDOMAIN.COM:88

kpasswd_server = camelot.MYDOMAIN.COM:464

}


[domain_realm]

.mydomain.com = MYDOMAIN.COM


[logging]

kdc = FILE:/var/log/krb5kdc.log

admin_server = FILE:/var/log/kadmin.log

default = FILE:/var/log/krb5lib.log


chmod 644 /etc/krb5.conf

Virtual Array 7100 / 7400 command view stuff

Managing SAN disk array subsystem:


NOTE: must run the following variable set in your telnet session in order to display X apps on your PC: export DISPLAY=myhostname:0 where 'myhostname' is your PC's name. You also must have the X client manager running on your PC.

Command View SDM (Storage Device Management) – software used to manage the array


VAnum1 – the 'alias' name of the Virtual Array disk system


directory of binaries: /opt/sanmgr/commandview/client/sbin


launcher – X client for managing the disk and creating LUNs. On LUN Management tab, Logical LUNs, you can create LUNs.

define LUN: This term is an acronym for Logical Unit. It is used as the primary means for dividing the entire capacity of the array into smaller, individually addressable, units. When created, contains no data. Read operations directed to this logical drive will return the format pattern until writes have been performed on the same locations.


cvui – command line menu based interface for managing the array. It's nice in the fact that it displays the command being run when you select a menu item. You can also log the commands and their results to a file if you wish.


cmdviewVA VAnum1 – Same as launcher, but skips first dialog listing the VA selection screen.


Then run sam, go under "Disks and File Systems/Disk Devices" to configure the volume group, logical volume(s), file system, etc.



listing free and used space on disks:

list kbytes of disk usage; use without 's' option to display all the files

du -sk /directory/path


pretty listing of total space allocated, used and free.

df -k /filesystem_mount

df -k /u* -- shows all /u00-u12 files system stats

oracle tips

Startup scripts:

/sbin/init.d/oracle

/sbin/init.d/sqlnet

/sbin/init.d/agentctl*

/sbin/init.d/oemctl*

(other similiary named files are in: /etc/rc.config.d)


Connecting to database with sysdba privledges from sqlplus command:

sqlplus "/ as sysdba"


Check if database started with a pfile or spfile:

in sqlplus:

SELECT DECODE(value, NULL, 'PFILE', 'SPFILE') "Init File Type"

FROM sys.v_$parameter WHERE name = 'spfile';


Check if database is in archive log mode:

in sqlplus do: archive log list


Converting from pfile to spfile or vice-verse:

CREATE PFILE FROM SPFILE;

CREATE SPFILE FROM PFILE;


Creating password file:

orapwd file=$ORACLE_HOME/dbs/orapw{SID} password=sys entries=1


Archive tips: http://www.cryer.co.uk/brian/oracle/SYMoixcal.htm


Archive log:

Must be in init{SID}.ora or spfile for archive log mode to be useful: LOG_ARCHIVE_START = true

alter system archive log start

alter system archive log stop

alter system switch logfile

select log_mode from v$database;

ALTER DATABASE ARCHIVELOG;

ALTER DATABASE NOARCHIVELOG;


Alert logs stored in: /u02/${ORACLE_SID{/bdump/alert_${ORACLE_SID}.log


Get some info on memory:

sqlplus> select * from V$SGASTAT;


Oracle management server startup:

NOTE: if changing username/password for the OEM database, YOU MUST edit oracle's .profile to reflect this change.


first start repository database:

export ORACLE_SID=OEMREP

sqlplus /nolog

connect / as sysdba

startup

exit


Then start the OMS server:


oemctl start oms

oemctl ping oms - shows status without having to issue username/password

oemctl stop oms sysman/{sysman's_password}


'oemctl start oms' output should be similar to:


mybox Oracle preprod1> oemctl start oms

OEMCTL for HP-UX: Version 9.2.0.1.0 Production

Copyright (c) 1998, 2002, Oracle Corporation. All rights reserved.

Starting the Oracle Management Server....


The OMS is now started and ready.




How does one start the Oracle Intelligent Agent?

One needs to start an OIA (Oracle Intelligent Agent) process on all machines that will to be managed via OEM. The agent needs to be stopped/started when a new database is created on that node. Databases that are removed will have to be deleted manually from the OEM console.

For OEM 9i and above:


agentctl start agent

agentctl stop agent

agentctl restart -- This doesn't seem to work.....


$ agentctl


Usage:

agentctl start|stop|status|restart [agent]

agentctl start|stop|status blackout [<target>]

[-d/uration <timefmt>] [-s/ubsystem <subsystems>]


The following are valid options for blackouts

<target> name of the target. Defaults to node target.

<timefmt> is specified as [days] hh:mm

<subsystem> is specified as [jobs events collections]

defaults to all subsystems



Creating a database

dbca - database configuration assistant X-gui app.

or

  1. Create an init file and proper directory structures for values in init file. Make sure remote_login_password=NONE

  2. Change /etc/tnsnames.ora and /etc/listener.ora to contain new database values. Reload the listener: lsnrctl, the reload.

  3. set ORACLE_HOME and ORACLE_SID to proper values for new database.

  4. run sqlplus and the following (/home/oracle/createdb.sql:

    • create database soup

    • logfile group 1 ('/ora/soup/redo01.log') SIZE 100M,

    • group 2 ('/ora/soup/redo02.log') SIZE 100M,

    • group 3 ('/ora/soup/redo03.log') size 100M

    • datafile '/ora/soup/system.dbf' SIZE 575M

    • character set WE8ISO8859P1

    • national character set utf8

    • extent management local

    • undo tablespace UNDOTBS1

    • datafile '/ora/soup/undotbs01.dbf'

    • SIZE 2000M

    • default temporary tablespace temp

    • tempfile '/ora/soup/temp01.dbf'

    • size 4000M autoextend on next 50M maxsize 7000M;


Starting EM (enterprise manager) from unix (x-gui):

oemapp console


OMS navigator needs to have databases deleted from it when the database is phyisically deleted. Refreshing the node won't remove the database from the navigator. In fact, it's best to delete the node from the navigator and re-add it again.


Stop Apache web server:

$ORACLE_HOME/Apache/Apache/bin/apachectl stop



What oracle version am I running?:

SQL> select * from v$version;


BANNER

----------------------------------------------------------------

Oracle9i Enterprise Edition Release 9.2.0.1.0 - 64bit Production

PL/SQL Release 9.2.0.1.0 - Production

CORE 9.2.0.1.0 Production

TNS for HPUX: Version 9.2.0.1.0 - Production

NLSRTL Version 9.2.0.1.0 - Production



Removing Oracle from a test server (sun box):

rm -r $ORACLE_HOME

rm -r /var/opt/oracle


Dropping a tempfile.

> sqlplus /nolog

sql> connect as sysdba


sql> alter database tempfile '/u08/mydb1/tempdave.dbf' drop;

-database altered


exit


drop tablespace logmnrts including contents;



CREATE

TEMPORARY TABLESPACE "TEMPNEW" TEMPFILE '/u09/mydb1/

TEMPNEW1.dbf' SIZE 5000M AUTOEXTEND

ON NEXT 640K MAXSIZE 7600M EXTENT MANAGEMENT LOCAL UNIFORM

SIZE 1024K;

ALTER DATABASE DEFAULT TEMPORARY TABLESPACE "TEMPNEW"


THEN


CREATE

TEMPORARY TABLESPACE "TEMP" TEMPFILE '/u07/mydb1/

TEMP01.dbf' SIZE 2500M REUSE AUTOEXTEND

ON NEXT 640K MAXSIZE 7600M EXTENT MANAGEMENT LOCAL UNIFORM

SIZE 1024K;

ALTER DATABASE DEFAULT TEMPORARY TABLESPACE "TEMP"


RMAN topics:

Recovery Manager User's Guide = a96566.pdf

Quick Start to Recovery Manager: page 75

Duplicating a Database with Recovery Manager: page 365

Recovery Manager Quick Reference = A96564.pdf

Recovery Manager Reference = A96565.pdf


Duplicating DB / random RMAN thoughts:

get a good RMAN backup of Production (takes about 10 MINUTES):

. rman target /

r shutdown immediate;

r startup mount;

r backup database;

r alter database open;

r quit



Then duplicate this backup to the auxiliary instance:

Target database must be open; auxiliary database must be started, in nomount mode.

When RMAN duplicate is finished the auxiliary database is opened.

Duplicate takes about 15 minutes.


Before running duplicate command, get the tempdata file name:

$ find /u??/mydb1/ -name "temp*"


. sqlplus "sys/null@mydb1 as sysdba"

s shutdown normal;

s startup nomount;

s quit

. rman target / auxiliary sys/null@mydb1

r duplicate target database to mydb1;

r quit


Re-add any datafiles that belong to the temp tablespace, and finish up other tasks:

. sqlplus "sys/null@mydb1 as sysdba"

s ALTER TABLESPACE TEMP

s ADD TEMPFILE '/ora/soup/temp01.dbf' SIZE 4000M REUSE;



in the auxilary init{sid}.ora and it's spfile:

DB_FILE_NAME_CONVERT=('/u00/proddb1/','/u00/mydb1/',

'/u01/proddb1/','/u01/mydb1/',

'/u03/proddb1/system01.dbf','/u05/mydb1/system01.dbf',

'/u09/proddb1/undotbs01.dbf','/u07/mydb1/undotbs01.dbf',

'/u07/proddb1/myapp_data01.dbf','/u05/mydb1/myapp_data01.dbf',

'/u08/proddb1/indx01.dbf','/u06/mydb1/indx01.dbf',

'/u03/proddb1/myapp_data02.dbf','/u02/mydb1/myapp_data02.dbf',

'/u09/proddb1/indx02.dbf','/u10/mydb1/indx02.dbf',

'/u12/proddb1/core_repository.dbf','/u12/mydb1/core_repository.dbf',

'/u06/proddb1/myapp_data02.dbf','/u05/mydb1/myapp_data02.dbf',

'/u12/proddb1/myapp_data02.dbf','/u11/mydb1/myapp_data02.dbf')

LOG_FILE_NAME_CONVERT=('/u00/proddb1/','/u00/mydb1/',

'/u01/proddb1/','/u01/mydb1/',

'/u02/proddb1/','/u02/mydb1/',

'/u03/proddb1/','/u03/mydb1/',

'/u04/proddb1/','/u04/mydb1/',

'/u05/proddb1/','/u05/mydb1/',

'/u06/proddb1/','/u06/mydb1/',

'/u07/proddb1/','/u07/mydb1/',

'/u08/proddb1/','/u08/mydb1/',

'/u09/proddb1/','/u09/mydb1/',

'/u10/proddb1/','/u10/mydb1/',

'/u11/proddb1/','/u11/mydb1/',

'/u12/proddb1/','/u12/mydb1/')



CREATE SPFILE FROM PFILE='/u01/app/oracle/admin/DUP/pfile/init.ora';


recreate tempfile in temp tablespace.

delete tempfile in OS first.


/u02/mydb1/temp01.dbf


ALTER TABLESPACE "TEMP"

ADD TEMPFILE '/u02/mydb1/temp01.dbf' SIZE 4000M REUSE;


HP-UX performance utils

MeasureWare (aka HP OpenView Performance Agent (OVPA)) – MWA (agent)

(NOTE The name MeasureWare Agent (MWA) has been replaced with HP

OpenView Performance Agent (OV Performance Agent or OVPA) for

UNIX and the name PerfView for UNIX has been replaced with OV

Performance Manager for UNIX throughout this documentation.

However, the process names and software components operationally

remain MeasureWare Agent (MWA) and PerfView.)


/opt/perf/examples/ - example config files

/opt/perf/bin/perfstat – checks status of agent processes

/var/opt/perf/datafiles – raw binary data files kept here

/var/opt/perf - config files kept here

alarmdef – alarm definition config file

parm - overall parameters config file


/opt/perf/bin/utility – outputs data from logfiles to stdout or files

/opt/perf/bin/extract – makes copies of raw binary data files for archival purposes or exports data from log files to standard format (csv, etc.)


mwa stop servers - stop mwa servers: alarm server, scopeux, etc. -- needed if you see a defunct process continually coming up: possible alarmdef file setting screwed up or corrupt.


Usage = mwa <action> <subsys> <parms>

<action> = status, start, stop, restart, demo, version

<subsys> = scope, server, alarm, db, desktop, all

<parms> = -midaemon <miparms>

See man midaemon for <miparms>

<action> and <subsys> may be entered in any order,

but if <parms> is supplied, then it must be entered last

Defaults: <action>=start, <subsys>=all, <parms>=""

note: mwa stop alarm is not valid.

mwa stop server will stop alarms and servers.



ARM (Applicaton Response Measurement): tracking application response as a whole as apposed to opposed to monitoring individual process.

GlancePlus – glance or (x) gpm

top – display top processes

uptime - system load, users and time since last boot

PRM – Process Resource Management: assigns levels of CPU/MEM/DISK/Application resources to particular users or processes. Sounds kind-of cool

printing tips for HP-UX

Add/remove printers by using SAM.

Optionally you may add jetdirect connected printers via: /opt/hpnpl/admin/hppi


Directories:

/var/spool/lp/request/{printername} = spool area for print jobs


disable printername = disable lp subsystem from sending data to the printer

enable printername = enable lp subsystem to send data to the printer

(the above commands are like using the "pause printing" function in windows)


Start/stop users from sending print jobs to the queue.

accept printername = allow the lp spooler to accept requests for the printer

reject printername = do NOT allow the lp spooler to accept requests for the printer

(the above commands are similar to turning on/off sharing on a printer in windows)


lpstat –t = display all printers status and output jobs (full report)

lpstat -pprintername = displays the specified printer's status

lpstat -s = print summary status for all printers

lpstat -o = list all output jobs on all printers

lpstat -oprintername = list all output jobs on the specified printers

lpstat -d Lists the system default printer

lpstat (no options) Lists the user's outstanding printer requests


man net_ljx000 = displays man page for net_ljx000 model script which display options the printer can accept.


lp –d printername filename = prints filename to the printer named: printername


lp –d printername –o options filename = prints filename to the printer named: printername using the printer specific options (such as landscape, nb, etc.)


list of common –o options:

c = compressed text

letter = 8.5 X 11

legal = 8.5 X 14

fp# = font pitch; Set the font pitch to <#> characters per inch.

lpi<#> = Print specified lines per inch, where <#> is 1, 2, 3, 4, 5, 6, 12, 16, 24, or 48.

duplex = prints on both sides of page

landscape = landscape orientation

portrait = portrait orientation (standard, default)


To cancel jobs

Either hit the cancel button on the laserjet or use the cancel command:

commonly used:

cancel printer12-123 - Cancels the printer12-123 job request

cancel printer12 - Cancels the currently serviced job on printer: printer12

cancel -e printer12 - Cancels all jobs (all users) on printer: printer12

cancel -udavid printer12 -Cancels all jobs submitted by user: david on printer: printer12



cancel Man page:

cancel Command

The cancel command cancels requests that were made with the lp

command, even if they are currently printing. At least one id or

printer must be specified.

The cancellation of a request that is currently printing frees the

printer to print its next available request.

id ... Specifies one or more requests. id is a request ID

returned by lp or lpalt.


printer ... Specifies one or more printers. printer is the name of

a printer, not a class. Either cancel the request that

is currently printing on each printer, or, if an -a, -

e, or -u option is specified, specify the printer on

which to perform the corresponding operation.


-a Remove all requests the user owns on each printer. The

owner is determined by the user's login name and the

host name of the machine where the lp command was

invoked.


-e Empty the spool queue of all requests for each printer.

Only users with appropriate privileges can use this

option.


-i Cancel only local requests.


-uuser Remove any requests belonging to user. You can repeat

the -u option to specify more users. Only users with

appropriate privileges can use this option.



Sometimes users will receive the following:

From: lp@mybox.mydomain.com

To: david@mybox.mydomain.com


error code 2 in request printer12-555 on printer printer12



They receive the message because of either hitting cancel on the printer's control panel (most likely), or there's a problem with the Jetdirect timing.




reset or query the GSP on HP systems

Reset the GSP - basically reboots the GSP, it DOES NOT reboot the server itself.  Use this when you receive the message:  "Request for console write access failed":

stty +resetGSP < /dev/GSPdiag1

See if the GSP is functional:
stty +queryGSP < /dev/GSPdiag1

resources:
http://docs.hp.com/en/B3920-90091/ch03s07.html

vim tips - folding / mutiple windows (viewports)

multiple windows / "viewports" - http://www.linux.com/article.pl?sid=06/05/04/1544258
folding (collapsing) lines/sections - http://www.linux.com/article.pl?sid=06/05/18/1915233

5.27.2006

netsh error - winsock corrupt

If you get this error when opening netsh:
Initialization Function InitHelperDll in IPMONTR.DLL failed to start with error code 11003

and it pauses for a long time before bringing up the netsh> prompt, then most likely the Winsock2 is corrupt, to recover delete the Winsock and Winsock2 subtrees from CurrentControlSet\Services and reboot, then reinstall TCPIP:  http://support.microsoft.com/kb/811259

5.23.2006

sum / total column adding in HPUX yields floating point notation

awk on HP-UX seems to use exponent notation instead of floating point notation like I'm used to in Tru64.  For example adding up (summing) a column in HPUX with large numbers yields an exponent number, not very useful to me.  To fix this behavior, use the OMFT variable in awk.  See the man page for awk for more info.

example:
ll /tmp| awk -v OFMT="%.f" 'sum += $5 {print sum}'

5.22.2006

convert LF to CRLF

Use the following to convert Unix to dos text files in cygwin on windows:
awk '{ print $0 "\r"}' unix.txt > dos.txt

source: http://www.datasavantconsulting.com/roland/tr.html

\r - carriage return
\n - line feed

5.18.2006

passwd prompts for old password

HP-UX:  Created account with UID 0, tried to change password using passwd.  Passwd prompted for the "old password" even though I was logged in as root.  The man page for passwd explains why:
Superusers are not prompted for old passwords unless they are attempting to change the superuser's password in a trusted system.


5.17.2006

UNIX Rosetta Stone

http://bhami.com/rosetta.html compare various Unix commands. If you don't know what Rosetta Stone means, look it up: http://www.answers.com/rosetta+stone&r=67


tags: unix comparision guide *nix tru64 aix hp-ux solaris irix linux freebsd openbsd netbsd sco differences matrix

5.16.2006

job name not known error

In HP-UX when trying to suspend (CTRL-Z) a process/job or when running a job in the background i.e: sleep 30 &   then running the jobs command, if you get message: <job name not known> then you'll need to defined the HISTFILE and HISTSIZE variables to fix the issue.

$ sleep 30 &
[1]     19870

$ jobs
[1] +  Running                    <job name not known>

or suspending the running command with CTRL-Z

$ sleep 20
[1] + Stopped                     <job name not known>

fixed by setting HISTFILE and HISTSIZE:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=200334 (ITRC login required)

export HISTFILE=$HOME/.history
export HISTSIZE=2000

$ sleep 20
[1] + Stopped                     sleep 20

5.15.2006

tail the mail log in HP-UX

mtail - tails the mail.log file (/var/adm/syslog/mail.log) on HP-UX systems.  It may be found on other *nix systems...

5.02.2006

Extra line breaks problem - Outlook 2003

How to stop Outlook from removing and screwing up the format. query: extra line breaks message removed outlook 2003

Two ways: Put two space at the beginning of each line: Article that describes the problem

Or turn off the option in Outlook 2003: Tools, Options, E-mail Options, uncheck: remove extra line breaks in plain text messages. Found this from the Jan 11, 2006 response to the article from "David".

learn HP-UX

One way to learn HP-UX commands is to use the key shell (keysh).  If you have a terminal that supports function keys, such as Reflection for HP, key shell will turn those function keys into prompts for different commands.  Once a command is finished, you'll see the exact command that is submitted to the shell, which makes learning the options easy.

Another good way to get familiar with HP systems is to use the HP-UX Software Recovery Handbook.  You can find individual PDF chapters for the handbook on HP's ITRC (I.T. Resource Center):  http://itrc.hp.com  (login required).  Look under the "knowledge trees" for "HP-UX Software Recovery Handbook"

Disable USB mass storage in Windows

Article discusses data security issues with USB mass storage devices and links to a MS article showing how to disable the drivers:
TechRepublic Blog: How secure is your data?

HOWTO: Use Group Policy to disable USB, CD-ROM, Floppy Disk and LS-120 drivers

4.29.2006

windows 2003 sp1 bug in file sharing

I guess by default in Windows 2003 SP1, you must use the actual server name when connecting to it via SMB.  In other words, you can't use a dns CNAME record to connect to that box's shares unless you do the following registry change:

http://www.intelliadmin.com/blog/2006/01/cname-sharing-disabled-in-windows-2003.html

4.27.2006

Explorer Destroyer - Switch to Firefox, Make money from Adsense Referral

Very interesting... Get paid by Google to help switch people to Firefox. Google is doing this because the Firefox that's downloaded is bundled with the Google Toolbar. It requires a Google Adsense account: www.google.com/adsense

Explorer Destroyer - Switch to Firefox, Make money from Adsense Referral

4.14.2006

Firefox keyboard shortcuts

keyboard shortcuts for Firefox I didn't know about.

F7 - Caret browsing

ALT-ENTER open URL in new TAB

ctrl-enter adds www. .com shift-enter www. .net ctrl-shift-enter www. .org

open find dialog: / just like in vi. (this tip came from Daniel http://dmiessler.com/archives/752 )

4.06.2006

Can't start Windows Firewall

Couldn't start windows firewall via control panel/security center. Tried starting the Windows Firewall services manually and got the following message:
could not start the windows firewall/internet connection sharing ics services
error 10047: an address incompatible with the requested protocol was used..

Fix: netsh winsock reset
then reboot
see -- After you run Microsoft Windows AntiSpyware (Beta), you have network-related problems, or you receive an error message

3.30.2006

DNS/Wins/DHCP links and articles

How to enable or disable DNS updates in Windows 2000 and in Windows Server 2003 - http://support.microsoft.com/kb/246804  (Good KB on how DNS updates are performed)


How to configure DNS dynamic updates in Windows Server 2003 - http://support.microsoft.com/kb/816592/
When one of these events triggers a DNS update, the DHCP Client service, not the DNS Client service, sends updates. If a change to the IP address information occurs because of DHCP, corresponding updates in DNS are performed to synchronize name-to-address mappings for the computer. The DHCP Client service performs this function for all network connections on the system. This includes connections that are not configured to use DHCP.



If you use multiple Windows Server 2003-based DHCP servers on your network and if you configure your zones to enable secure dynamic updates only, use the Active Directory Users and Computers snap-in to add your DHCP server computers to the built-in DnsUpdateProxy group. When you do this, all your DHCP servers have the secure rights to perform proxy updates for any one of your DHCP clients. For more information, see the "Using DNS servers with DHCP" topic or the "Manage groups" topic in Windows Server 2003 Help.


Netbios name resolution requirements of exchange server 2003 - http://www.computerperformance.co.uk/w2k3/services/WINS_exchange.htm

WINS in Windows 2003 - http://www.computerperformance.co.uk/w2k3/services/WINS_Home.htm

WINS/DNS Integration - http://www.computerperformance.co.uk/w2k3/services/WINS_DNS.htm

WINS replication - http://www.computerperformance.co.uk/w2k3/services/WINS_Replication.htm

WINS troubleshooting - http://www.computerperformance.co.uk/w2k3/services/WINS_Troubleshooting.htm

DNS preferred order - http://support.microsoft.com/kb/286834

How to migrate a WINS Database from Windows 2000-based WINS server to a Windows 2003-based WINS server - http://support.microsoft.com/kb/875419
How to view and transfer FSMO roles in Windows Server 2003 - http://support.microsoft.com/kb/324801
How to move a DHCP database from a computer that is running Windows NT Server 4.0, Windows 2000, or Windows Server 2003 to a computer that is running Windows Server 2003 - http://support.microsoft.com/kb/325473
How to upgrade Windows 2000 domain controllers to Windows Server 2003 - http://support.microsoft.com/kb/325379

videos: Managing Windows Server 2003 Best Practices (FSMO,DHCP,DNS,WINS) -  http://www.microsoft.com/technet/community/events/windows2003srv/tnt1-106.mspx

dhcp bp - http://technet2.microsoft.com/WindowsServer/en/Library/75cd0e1f-f464-40ea-ac88-2060e6769f331033.mspx
wins bp - http://technet2.microsoft.com/WindowsServer/en/Library/ed9beba0-f998-47d2-8137-a2fc52886ed71033.mspx

dsa.msc /server=ipaddress


3.29.2006

Ascii chart with the control codes/characters

ASCII table with control chars:
http://www.commonsoftinc.com/Babylon_Cpp/Documentation/Res/KASCIICharTab
le.htm

shell file name completion

On some Linux distros-
To have the shell complete the name using the Esc, Esc keystrokes:

set -o vi-esccomplete

Find unix (HP-UX) memory hog

Finding HP memory hog:

UNIX95= ps -xeo 'vsz pid args' |sort -nr|more

Curl and proxysg

Getting past proxysg via curl:

curl -u : --ntlm --location-trusted -b cookie.jar -c cookie.jar
http://www.bonhamconsulting.com

with curlrc in place:  (--location disables the -L in the curlrc file)
curl -u : --ntlm --location --location-trusted -b cookie.jar -c cookie.jar
http://www.bonhamconsulting.com

Listing HP-UX kernel parameters

HP Kernel parameters:

listing:
sysdef

kmtune
kmtune -l
kmtune -l -q {parameter}
ex: kmtune -l -q dbc_max_pct or just: kmtune -q dbc_max_pct

How to monitor a terminal session

shadow/view/watch a telnet session:

on the viewer's telnet session: chmod 666 /dev/pts/xx

on the "watched" session side, do: program_name | tee /dev/pts/xx

or just: script /dev/pts/xx

Test smtp using telnet

telnet smtp_server 25

RSET   (does a reset, if you happen to screw up one of the lines)

HELO mymail.me.local
MAIL FROM:<fromme@me.local>
RCPT TO:<toyou@you.local>
data

From: fromme@me.local
To: toyou@you.local
Date: Tue, 02 Aug 2005 12:24:31 -0500
Subject: this is a test

This is a manual smtp mailing test.

.


Note the single period on a line by itself at the end of the message.

View full email message source in Outlook 2003

View full email message source, not just headers in Outlook 2003:

http://www.slipstick.com/mail1/viewheaders.htm

HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\Options\Mail\SaveAllMIMENotJustHeaders = 1 (Reg_Dword)

3.28.2006

Citrix Metaframe client hangs

If the Citrix Metaframe client hangs after it says "connection established", "negotiating capabilities", then upgrade to version 9 or higher.  I think there are some issues running version 8.00.24737 as a "regular" or restricted user and not an administrator or power user.

STP on TruCluster NICS

Any NICs in a Tru64 TruCluster environment, whether they be the cluster interconnect or the regular public lan NICs, should have spanning tree protocol (STP) turned off on the port they are connected to. See the TruCluster Server Cluster Administration guide (part number: AA-RHGYE-TE

On a Cisco switch, in enable mode:

config t
interface FastEthernet0/1
no spanning-tree portfast

Don't forget to save the running config to nvram.

Remove the drunk monkey logo

Has this ever happened to you?:  one day you reboot your Windows 2000 machine to find that the default blue background at the control-alt-del screen has been changed to a white background with 3 drunk monkeys at the bottom of the screen.  For some odd reason this also coincides with departure of a former employee.  Curious huh?
 
Anyway to get rid of the monkeys, look in
HKEY_USERS\.Default\Control Panel\Colors
 
copy the value of Background_old to Background
 
in
HKEY_USERS\.Default\Control Panel\Desktop
 
copy the value of Wallpaper_old to Wallpaper
 
You can also get rid of the C:\winnt\drunk_logo.bmp file.

Spam map

Worldwide spam map:  http://www.trustedsource.org
also seems to include info specific domains.

3.27.2006

Get AlphaServer SRM console version

To get the SRM console version (firmware) on an Alpha Server via a shell:
consvar -g version
Output will be something like this:
version = V7.0-3 Jun 16 2005 14:53:11
 
Get some more detailed info with the first two lines of output:
# consvar -v -l
Firmware Rev: 7.0-3
system fam:38  cpu:8  smm:1978

 
get the PALcode similarly:
consvar -g pal
 
Output will be something like this:
pal = OpenVMS PALcode V1.98-43, Tru64 UNIX PALcode V1.92-33

Remove formatting from man pages

To remove the formatting from man pages so that you can redirect them to text and view in vi or another editor you can create a shell alias and associated script:
 
alias mantext='~/bin/mantext.ksh'
 
mantext.ksh:
man $1 | sed -e 's/.//g'
 
Now use mantext instead of man when redirecting a man page to a file.
 

3.26.2006

transition from batch to unix shell scripts

Converting DOS Batch Files to Shell Scripts - http://www.tldp.org/LDP/abs/html/dosbatch.html
Beginner's Guide to Unix Shell Programming - http://www-rnks.informatik.tu-cottbus.de/de/staff/mm/docs/BeginnersGuideToUnixShellProgramming.html

cron deficiencies

I was told to make a process run the first day of every month, but cron doesn't have the "smarts" to do it.  I found the following solution to be adequate:

From: http://www.darklab.net/resources/hpux-mailinglist/0715.html

DO SOMETHING ON THE LAST DAY OF A MONTH
 
Unfortunately, cron does not give us a simple way to say
'run this on the last day of month'. Fiddling with the
different length months, leap years, y2k bugs and so on is
messy. Here's a simple solution that gives all the dirty
work to some well tested utility. The idea is to check whether
*tomorrow* is the first day of a month.
 
Solution 1 (using date, change MET to your local time zone)
 
#!/bin/sh
if test `TZ=MET-24 date +%d` = 1; then
   # today is the last day of month
fi
 
You can call this script from cron, say with a crontab of
4 2 28-31 * * /path/to/your/script

3.21.2006

Copy IAS configuration

I was getting a Reason-Code 16 in the system eventlog on a Windows 2003 ISA server and didn't know if the secret for the Radius clients was wrong, or if my config was wrong.  I had a Windows 2000 IAS server that was functioning fine.

I copied the IAS config from the Win2k box to the 2k3 box:
http://support.microsoft.com/kb/317589

By running netsh aaaa config > 2000.txt   and then running netsh exec 2000.txt on the Windows 2003 server.

Then my 2003 IAS started working.

RightFax Fax Cover Sheet conversion issues

The workservers would hang or crash when using Microsoft Word to convert the FCS.  You couldn't stop them in the Enterprise Fax Manager; they would just stay in a "stopping" state.  You would have to kill the workserver.exe processes.  Converting these to the RightFax native PCL format solved the issue and increased the stability and performance of RightFax in a huge way.

 

FCS (Fax Cover Sheets) are stored in Rightfax\FCS.  The source (word document) file is in a subfolder of FCS.  Typically the cover sheet should be PCL format.  See the AdministratorsGuide.pdf for details on how to create a FCS.

 

Using the built-in Windows 2000 HP LaserJet 4000 PCL driver produced the best results for us.

 

Here are some articles from Captaris that are useful:

190 - How do I run a RightFax 8.x or 9.0 WorkServer in Debug Mode?

3537 - Important information on Server Side Application (SSA) conversion using Microsoft Office applications

 

Basically don't use Word to do your fax cover sheet (FCS) conversion…..

3.20.2006

Changing MSDE sa password

How to change the sa password of a MSDE database - http://support.microsoft.com/kb/321081
 

RightFax 9.0 upgrade from 8.5

I recently lead an upgrade and migration to a new physical server from Rightfax 8.5 on Win2k to 9.0 (with SP2) on Win2003 with Brooktrout TR114 Fax boards.  Here are some "Answer ID" documents from Captaris' knowledge base that are fairly important when migrating the configuration to a new server:
www.captaris.com look under support / knowledge base
 
2933 - RIGHTFAX 9.0 UPGRADE FAQ
2110 - Upgrading to RightFax version 9.0
 
I would also recommend taking screen shots or documenting all the settings in the control panel's applets on the old server.
 
Rightfax installs MSDE by default and it has a default 'sa' account with a blank password.  See the following answer ID and kb article title for a description of the areas in the Rightfax configuration that you need to change.
3449 - How do I change my 'sa' password in MSDE, and where do I modify the password in RightFax 9.0 SP1?
 
During the install I mistyped the password or username that a number of the Rightfax services run under.  (The installer will tell you the password or username is wrong but doesn't let you go back and correct the issue).  This causes the Workserver1, workserver2, workserver3 services never to be created and thus the Rightfax services don't startup properly.  I got a bunch of errors in event logs.  To recreate the services (this applies to any Rightfax service), you use the proper RightFax control panel applet (or right-click, configure the service in Enterprise Fax Manager).  In this case, open the "RightFax WorkServer" applet and then select the button at the bottom: "Select Service Account" and fill in the fields.  When you OK out of the dialogs the Workserver1,2,3 will be recreated.  Again if you foo-barred the password during the install you will need to do this on the following control panel applets:  RightFax E-Mail Gateway, RightFax Server (in the Advanced tab), and the RightFax WorkServer.  If more Rightfax options are installed, more applets may be installed.
 
Also Windows 2003 contains Brooktrout fax board drivers, but they don't work with the driver that RightFax needs/uses.  I had to follow the following knowledgebase articles:
215 - RightFax & Windows 2003 - How to remove the Brooktrout TR114/TruFAX PnP driver
After following that article I still needed to remove the faxboards in the RightFax DocTransport applet then re-add them.  This recreated the FaxBoard service so that it did not depend on the bfax driver.  If I didn't remove the fax boards and re-add them, then I got a whole bunch of errors in the event log.

3.18.2006

Windowsupdate error 0x80072F76

When trying Windows Update (www.windowsupdate.com or update.microsoft.com) I got the following error instead of the normal "Express" and "Custom" scan buttons:
The website has encountered a problem and cannot display the page you are trying to view. The options provided below might help you solve the problem.
error 0x80072F76

Along with these entries in %systemroot%\WindowsUpdate.log:
2006-03-18 15:29:28  372 cd0 Misc WARNING: DownloadFileInternal failed for http://update.microsoft.com/v6/windowsupdate/selfupdate/wuident.cab : error 0x80072f76
2006-03-18 15:29:28  372 cd0 WUWeb FATAL: CheckIfClientUpdateNeeded failed: error 0x80072f76

http://support.microsoft.com/kb/836941

TDS accelerator was enabled and running.  I disabled the TDS download accelerator and was able to scan for updates on Windowsupdate.

 

3.17.2006

urldecode

Online pages where you can post URL encoded (%20, etc...) data and get the decoded (human readable) version. On both of these sites you can encode or decode a URL.
http://www.albionresearch.com/misc/urlencode.php
http://www.simplelogic.com/Developer/URLDecode.asp

3.14.2006

disable the F8 safe mode

Here's how to disable the F8 key to get into safe mode.  You may want to use this in a kiosk environment where you want to prevent someone going into safe mode:

http://groups.google.com/group/microsoft.public.win2000.security/browse_thread/thread/4db76c0cf6d216be?hl=en&
aka http://tinyurl.com/h89j3

http://www.kixtart.org/ubbthreads/showflat.php?Cat=&Number=132165&page=&view=&sb=5&o=&vc=1

3.12.2006

Unload application disbled /greyed out in IIS

In IIS6 application unloading / recycling is handled differently.  You may notice that the "Unload" button is greyed out or disabled in the Application Settings area.  This is because the application is in native IIS 6 mode using application pools.  Synonymous to unloading the application in IIS 5 is the concept of recycling the application pool in IIS6, see the Application Pools folder in IIS manager (inetmgr).  The only time the Unload button will work is if the IIS web service is running in IIS 5.0 isolation mode and the Application Protection is set to either Medium or High.

3.10.2006

HSG80 controller - setting time

set [this_controller | other_controller ] time 11-mar-2006:08:10:15

For instance, to set the time on the attached controller ("this" abbreviated) to 3/11/2006 at 8:10:15 am --
set this time 11-mar-2006:08:10:15

3.08.2006

blogger "mail-to-blogger" feature stops working - marked as draft

If you used to be able to use the mail-to-blogger feature to email posts and have them publish directly to you blog, but now they don't publish and instead sit in your lists of posts as a draft, then your blog has been flagged as possible spam blog.

Why are all my posts being set to drafts? - http://help.blogger.com/bin/answer.py?answer=1263

Edit just one draft and by the word verification area click the ? question mark. Blogger will review your blog to verify it's not spam and you'll be able to publish like you used to. I'm not certain what triggers blogger to mark the blog as spam, but this blog was marked and hopefully they'll review it and find it's nothing more than silly old me.

What's a Spam Blog? - http://help.blogger.com/bin/answer.py?answer=1260 (excerpt: they can be recognized by their irrelevant, repetitive, or nonsensical text) -- that pretty much characterizes my style of writing: "nonsensical text"! HA!

3.07.2006

Admin Scripts - Earn $100

You can earn $100 by sending TechRepublic your original sys admin scripts. I've got a few that I think may earn me some money. Might as well..
http://techrepublic.com.com/5100-1035_11-6045607.html?tag=search