2011年7月13日 星期三

using ssh via perl

#!/usr/apps/perl/rhel4.x/bin/perl
use Net::SSH::Perl;
my $ssh = Net::SSH::Perl->new("server");
$ssh->login("id", "password");
my($stdout, $stderr, $exit) = $ssh->cmd(" /root/digitemp-3.6.0/digitemp_DS9097U -q -c /root/digitemp-3.6.0/digitemp.conf -a");$index=0;
my @values = split('\n', $stdout);
foreach my $val (@values) {
my @obj=split(' ',$val);
if ($#obj ==8 ){
$Temperature=$Temperature . "T$index:$obj[8] ";
$index++;
}
}
print substr($Temperature,0,length($Temperature)-1);

2011年7月12日 星期二

add service Linux system

# chkconfig: 2345 55 25
2345 for runlevel
55 for start priority
25 for kill priority
# description: Service Description

2011年7月5日 星期二

Linux printer server setup

Package need:
1: pdfdistiller  PDF engine
2: Imaging  image engine
3: pkpgcounter  page counter
4: tea4cup  backend daemon
System folder
1: /usr/share/cups/model  printer driver default path
2: /etc/cups  cups and tea4cups configuration file path
3: /etc/cups/ppd  printer driver for each printer. Naming rule is same as printer name
4: /usr/lib/cups/backend  backend folder. Printer interface definition
Configuration file
1: /etc/xinetd.d/cups-lpd  lpd printer
2: /etc/cups/cupsd.conf  cupsd configuration file
3: /etc/cups/tea4cups.conf  tea4cups configuration file
4: /etc/cups/mime.convs  mime application and filter mapping
5: /etc/cups/mime.types  mine type definition
Daemon
1: /etc/init.d/cups
2: /etc/init.d/xinetd
Setup
cp pdfdistiller /usr/lib/cups/backend;chmod +x pdfdistiller
cp tea4cups /usr/lib/cups/backend;chown root:root tea4cups;chmod 700 tea4cups;
install Imaging and pkpgcounter  python setup.py install
vi /etc/cups/tea4cups.conf
under the global segment
prehook_keep : ps2pdf $TEADATAFILE /tmp/print/log/audit/$TEAPRINTERNAME.$TEAJOBID-$TEACLIENTHOST.$TEAUSERNAME.pdf

prehook_log : echo `date +%Y/%m/%d\ %H:%M` $TEAPRINTERNAME $TEAJOBID $TEACLIENTHOST $TEAUSERNAME `pkpgcounter $TEADATAFILE`\"$TEATITLE\" >> /var/log/printaccounting.log
Printer installation:
Linux: lpadmin –p queue name –m dirver –v lpd://printer_server/queue_name-E
Unix: lpadmin -p kido -v /dev/null -m netstandard -o protocol=bsd -o dest=10.88.229.75:text -o timeout=5 -o nobanner -D "Plotter in copy room"

Printer Server: lpadmin -p ljet1 -m PrintAudit.ppd -v tea4cups:lpd://10.88.228.9/LPD -E -L "Copy Room" -D "HP Laser Printer"

2011年7月1日 星期五

Add JRE plugin in RHEL 64 bits version

By default, system built-in browser, seamonkey is a 64bits application. However the browser only accepts 64bits plugins. Unfortunately, there are no JRE plugins can run without any problem with seamonkey. Only you can do is download the 32 bits firefox and add the 32 bits JRE plugins.

1: Download firefox from official site.
2: Untar the source file. ( tar zxvf firebox-x.x.x.tar.gz )
3: Download JRE from Sun. Because we want to have java applet and java web start function, please download the i586 version.
4: execute the downloaded bin file. ( chmod a+x jre-x_x_x-linux-i586-rpm.bin; /download_Path/jre-x_x_x-linux-i586-rpm.bin)
5: all JRE files will be located under /usr/java/jre_VERSION
6: link plugin to browser. ln –s /usr/java/jre_Version/plugin/i386/ns7/libjavaplugin_oji.so /download_Path/firebox/plugins/
7: launch the browser  /download_Path/firebox/firebox
8: check plugin status  go to url: about:plugins to check

2011年6月16日 星期四

pst default location

HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook
ForcePSTPath
REG_EXPAND_SZ

'Option Explicit
Set objFSO = CreateObject("Scripting.FileSystemObject")
msgbox "Default PST path setup wizard!",vbInformation ,"Default PST path setup kit"
MyPath = Trim(BrowseFolder( "My Computer", False ))
If ( Len(MyPath) > 3 ) and objFSO.FolderExists(MyPath) Then
  RunShell "reg add ""HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook"" /v ForcePSTPath /t REG_EXPAND_SZ /d """ & MyPath & """ /f"
  Wscript.Echo "Default PST folder is set to : " & ReadReg("HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\ForcePSTPath")
End If
Sub RunShell(cmd)
  Set objShell = CreateObject("WScript.Shell")
  objShell.Exec(cmd).Stdout.ReadAll
End Sub
Function ReadReg(reg_path)
  Set objShell = CreateObject("WScript.Shell")
  ReadReg = objShell.RegRead(reg_path)
End Function
Function BrowseFolder( myStartLocation, blnSimpleDialog )
    Const MY_COMPUTER   = &H11&
    Const WINDOW_HANDLE = 0 ' Must ALWAYS be 0
    Dim numOptions, objFolder, objFolderItem
    Dim objPath, objShell, strPath, strPrompt
    ' Set the options for the dialog window
    strPrompt = "Select a folder:"
    If blnSimpleDialog = True Then
        numOptions = 0      ' Simple dialog
    Else
        numOptions = &H10&  ' Additional text field to type folder path
    End If
   
    ' Create a Windows Shell object
    Set objShell = CreateObject( "Shell.Application" )
    ' If specified, convert "My Computer" to a valid
    ' path for the Windows Shell's BrowseFolder method
    If UCase( myStartLocation ) = "MY COMPUTER" Then
        Set objFolder = objShell.Namespace( MY_COMPUTER )
        Set objFolderItem = objFolder.Self
        strPath = objFolderItem.Path
    Else
        strPath = myStartLocation
    End If
    Set objFolder = objShell.BrowseForFolder( WINDOW_HANDLE, strPrompt, _
                                              numOptions, strPath )
    ' Quit if no folder was selected
    If objFolder Is Nothing Then
        BrowseFolder = ""
        Exit Function
    End If
    ' Retrieve the path of the selected folder
    Set objFolderItem = objFolder.Self
    objPath = objFolderItem.Path
    ' Return the path of the selected folder
    BrowseFolder = objPath
End Function

2011年6月13日 星期一

autohotkey autofill

IfWinExist AP
{
WinActivate, AP
Send
}

2011年6月9日 星期四

nfs mount permission deny

showmount is without any problem, but will fail on mounting through nfs
nfsd /proc/fs/nfsd nfsd auto,defaults 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs auto,defaults 0 0


http://www.linuxforums.org/forum/networking/44779-nfs-permission-denied-error.html