Wednesday, January 16, 2013

"Automagic" mount (at boot time) of a windows folder in FreeBSD 7

Mounting share folder at boot time looks like easy yeah.... but you need to know what the trick is.

From my gist: https://gist.github.com/vicendominguez/8806533
"Automagic" mount (at boot time) of a windows folder in FreeBSD 7!
------------------------------------------------------------------
@vicendominguez
* Enviroment:
- shared folder in windows 2003 with user/pass
- FreeBSD 7.00
* Pre:
- smbclient to check the permissions
- mount_smbfs should be available. It will load the correct .ko in the kernel.
* First Checks:
- check with smbclient if you can access to the shared folder with the user/pass (smbclient implements CIFS directly without kernel or fs layer)
* Procedure:
- Create a /etc/hosts entry with the windows name of the box and his IP. By example:
10.0.0.14 sbsserver
- Create line in the fstab file (/etc/fstab) like:
//user@sbsserver/dir /mnt/windowslocal smbfs rw 0 0
- user: windows user
- dir: it is the windows shared folder
- Create credentials in /etc/nsmb.conf like:
[SBSSERVER:USER]
password=mypass
========= STOP HERE - VERY IMPORTANT!!!! ==================
In the /etc/nsmb.conf the CAPS is a MUST! hostname and user MUST be in CAPS!
===========================================================
- "mount /mnt/windowslocal" should work without ask the password.
- If everything is ok, when the system is booting, it should mount the shared folder from windows.
view raw gistfile1.txt hosted with ❤ by GitHub
:)

Friday, January 4, 2013

Installing Navisphere CLI on CentOS 6.2

Yes! you need to find the NaviCLI-Linux-64-x86-en_US-7.31.25.1.24-1.x86_64.rpm file. And yes, it is not easy. Google is your friend.

Installing Navisphere CLI on CentOS 6.2
--------------------------------------------------
twitter: @vicendominguez
* If you have this problem with dependences:
# rpm -ivh NaviCLI-Linux-64-x86-en_US-7.31.25.1.24-1.x86_64.rpm
error: Failed dependencies:
libc.so.6 is needed by NaviCLI-Linux-64-x86-en_US-7.31.25.1.24-1.x86_64
libc.so.6(GLIBC_2.0) is needed by NaviCLI-Linux-64-x86-en_US-7.31.25.1.24-1.x86_64
libc.so.6(GLIBC_2.1) is needed by NaviCLI-Linux-64-x86-en_US-7.31.25.1.24-1.x86_64
libc.so.6(GLIBC_2.3) is needed by NaviCLI-Linux-64-x86-en_US-7.31.25.1.24-1.x86_64
libdl.so.2 is needed by NaviCLI-Linux-64-x86-en_US-7.31.25.1.24-1.x86_64
libdl.so.2(GLIBC_2.0) is needed by NaviCLI-Linux-64-x86-en_US-7.31.25.1.24-1.x86_64
libdl.so.2(GLIBC_2.1) is needed by NaviCLI-Linux-64-x86-en_US-7.31.25.1.24-1.x86_64
Try:
# yum install glibc-utils.x86_64 compat-glibc-headers.x86_64 glibc.i686
And:
# rpm -ivh NaviCLI-Linux-64-x86-en_US-7.31.25.1.24-1.x86_64.rpm
Preparing... ########################################### [100%]
1:NaviCLI-Linux-64-x86-en########################################### [100%]
Run the script /opt/Navisphere/bin/setlevel_cli.sh to set the security level before you proceed.
#
view raw gistfile1.txt hosted with ❤ by GitHub
;)

Wednesday, January 2, 2013

Commvault backups history from Windows Terminal.

It is tested with CommVault 9 and you will need to install qcommands (it comes with commvault).

The authentication is out of the script (at the moment). Remember to execute 'qlogin' to validate the user/pass first.

' Dirty script to check Failed backups from Commvault 9.00
' Author: Vicente Dominguez - contact via Twitter @vicendominguez ;)
' Require: qlist from qcommands (Commvault 9.00)
' Save as check_commvaulthistory.vbs in server with commvault sw install
' Command line to execute: cscript //nologo check_commvaulthistory.vbs
' Remember to execute 'qlogin' to validate the user/pass
Option Explicit
' On Error Resume Next
Function getCommandOutput(theCommand)
Dim objShell, objCmdExec
Set objShell = CreateObject("WScript.Shell")
Set objCmdExec = objshell.exec(thecommand)
getCommandOutput = objCmdExec.StdOut.ReadAll
end Function
' Formatting output from qlist command (if qlist output changes... be careful here)
Function CreateArrayClient()
Dim ClientList(), ClientAux, ClientArray, ClientName, NumList
ClientArray = split (getCommandOutput ("qlist client"), vbNewLine)
NumList = 0
For Each ClientAux in ClientArray
' Dynamic array resize
redim preserve ClientList (NumList)
' Output 'qlist' validation, min two chars in name to be ok
If Len (ClientAux) > 2 Then
ClientName = Split (ClientAux, " ")
' Client must be "ACTIVE"
If InStr (Mid(ClientAux,47), "Yes") Then
ClientList(NumList) = ClientName(0)
NumList = NumList + 1
End If
End If
Next
CreateArrayClient = ClientList
End Function
Function GetHostHistory (Hostname)
Dim HostHistory
HostHistory = getCommandOutput("qlist jobhistory -c '" & Hostname & "'")
GetHostHistory = HostHistory
End Function
Function GetHostFailedHistory (Hostname)
Dim HostHistory
HostHistory = getCommandOutput("qlist jobhistory -js Failed -c '" & Hostname & "'")
If InStr (HostHistory, "No jobs to display") Then
GetHostFailedHistory = 0
Else
GetHostFailedHistory = 1
End If
End Function
Sub BackupAudit ()
Dim Hostname
For Each Hostname in CreateArrayclient
If Len (HostName) > 1 Then
If GetHostFailedHistory (Hostname) Then
Wscript.Echo Hostname & " FAIL: " & GetHostHistory (Hostname)
Else
Wscript.Echo Hostname & " OK "
End If
End If
Next
End Sub
BackupAudit()
:)