Friday, July 15, 2011

Legato/EMC Networker: Repairing bogus expiration date on backup tape volumes

When using Legato/EMC Networker, occasionally happens that due some error in one or more save sets that are suited on one volume, expiration date of that volume is bogus (not according the retention time of the saveset that have biggest retention time).

So in order to fix this situation GUI will not offer you a proper way to do it. Therefore you have to do some typing by executing networker cli commands:

1. From the GUI (same can be done from cli, but it will not be mentioned here) take a note of the Volume name that have bogus expiration date

2. List the savesets that are suited on that volume by entering following cli command:

# mminfo -p -q "volume=volume_name"

From this list, take a note of the ssid number/name of the affecting saveset which have improper retention date.

3. Change the date of "bogus" saveset to corespond to your retention policy

# nsrmm -S ssid -e "mm/dd/yyyy 23:59:59" -w "mm/dd/yyyy 23:59:59"

Repeat this step if multiple savesets have bogus retention time.

At the end, when all savesets from that Volume have correct retention time, go back to GUI and check if problem with expiration date is solved. If not, repeat step #2 and check if you have missed some Save set with bogus retention time.


Monday, July 11, 2011

If ORACLE IAS Report server won't start

If you tried everything and still you cannot start reports service on you Oracle IAS - assuming that you did not made any configuration change, then following should help you:

opmnctl stopall
cd $ORACLE_HOME\reports\server\
mv repXXXXXXX.dat repXXXXXXX.dat.old (where XXX is the name of your reports server)
opmnctl startall

If this *.dat file somehow became inconsistent or corrupted, then IAS Reports server fail to start. Simple delete or renaming of old dat file will solve the problem. After restarting with opmnctl, appropriate dat file will be re-generated.

Monday, May 23, 2011

Check Today's and Tomorrow's temperature - Skopje R. Macedonia

For all who lives in Skopje, R.Macedonia:

#!/bin/sh
#export http_proxy=
fajl=`wget -q -O temp.vreme http://www.weather.com/weather/today/Skopje+Macedonia+MKXX0001`
denes=`cat temp.vreme | grep Today | grep Column | cut -d "\"" -f 2 | cut -d " " -f 1`
noke=`cat temp.vreme | grep Tonight | grep Column | cut -d "\"" -f 2 | cut -d " " -f 1`
utre=`cat temp.vreme | grep Tomorrow | grep Column | cut -d "\"" -f 2 | cut -d " " -f 1`
temperatura_utre_f=`cat temp.vreme | grep $utre | grep forecast-temperature\" | cut -d ">" -f 3 | cut -d "&" -f 1`
temperatura_utre_c=`echo "(5.0 / 9.0) * ($temperatura_utre_f -32)" | bc -l | cut -d "." -f1`

temperatura_denes_f=`cat temp.vreme | grep $denes | grep forecast-temperature\" | cut -d ">" -f 3 | cut -d "&" -f 1`
temperatura_denes_c=`echo "(5.0 / 9.0) * ($temperatura_denes_f -32)" | bc -l | cut -d "." -f1`
temperatura_noke_f=`cat temp.vreme | grep $noke | grep forecast-temperature\" | cut -d ">" -f 3 | cut -d "&" -f 1`
temperatura_noke_c=`echo "(5.0 / 9.0) * ($temperatura_noke_f -32)" | bc -l | cut -d "." -f1`
zenity --info --title "Vremesnka Prognoza - Skopje, Makedonija" --text "Utre: $temperatura_utre_c stepeni \nDenes: $temperatura_denes_c stepeni\nNokeska: $temperatura_noke_c stepeni"
#echo Temperaturata utre ke bide $temperatura_utre_c stepeni
rm temp.vreme

Friday, May 20, 2011

Make "stable" CCcam



One who is using CCcam know that usually CCcam after some time generate segmentation fault so there is no more active soft-cam reader in your linux based STB, and even you have your subscription card inside STB, you'll get black screen. Therefore you must re-start CCcam manualy. Other solution is to use following script which will check every 10 seconds if CCcam is running.



#!/bin/sh
while :
do
proces=`ps -A | grep CCcam | cut -f2 -d " "`
if [ -z $proces ]
then
/var/bin/CCcam &
sleep 5
fi
sleep 10
done

Wednesday, May 18, 2011

NAGIOS plugin - Check for number of active users on Windows Terminal Server

Following is NAGIOS plugin (windows batch script) which check for number of logon users on Windows Terminal Server. Plugin is useful to create statistic so later you can check and plan if you need one more Terminal server in your TS farm :)

Here is the code:

@set norm=%1
@set warn=%2
@set crit=%3
@echo %norm% , %warn% , %crit%
@for /f "delims=" %%a in ('"query user | find /C /v"USERNAME""') do @set brojka=%%a
@if %brojka% LEQ %norm% goto :zeleno
@if %brojka% LEQ %warn% goto :zolto
@if %brojka% GEQ %crit% goto :crveno
:zeleno

@echo OK, %brojka% Users
@echo "|currentloggedusers=%brojka%

:crveno
@echo CRITICAL, %brojka% Users
@echo "|currentloggedusers=%brojka%

:zolto
@echo WANRNING, %brojka% Users
@echo "|currentloggedusers=%brojka%

Solaris shell script for parsing large XML file into multiple XML files. Create PDF and prepare meta data for email sending mechanism

This script I wrote because billing system in my company produces complex and big XML output - 1 file with multiple invoices inside. Request from business department was to split this large file into multiple XML files - one file per invoice. In same time, header and footer section from large XML must be merged into every single small file. Main goal is to create PDF invoice file and send it as attachment by email using customer's email address.

After splitting process, every file should be used as input for generating PDF file. For generating PDF file from XML I am using DETEC's product "LaserSoft". At top of all, meta data file should be created with email client address extracted from XML file and name of PDF file generated for that invoice. This meta data file will be used later in post process of sending PDF file to customer's email address.




[quote]
#!/bin/sh
rm /u01/app/company/fileio/billing/efakturi/meta.txt
input_fajl=$1
red=0
sleden_red=0
broj_linii=`cat $input_fajl | /usr/xpg4/bin/grep -n '' | cut -d ":" -f 1`
pocetok_footer=`cat $input_fajl | /usr/xpg4/bin/grep -n '' | cut -d ":" -f 1`
cat $input_fajl | /usr/xpg4/bin/grep -n ''| cut -d ">" -f2 | cut -d "<" -f 1 > ./tmp/kunde
nawk -v pocetok_footer="$pocetok_footer" -v krajna_linija="$krajna_linija" 'NR== pocetok_footer,NR== krajna_linija' $input_fajl > ./tmp/footer
nawk -v kraj_header="$kraj_header" 'NR==1,NR== kraj_header' $input_fajl > ./tmp/ header
while [ $broj_linii -gt 0 ]
do
red=$red+1
sleden_red=$red+1
linija=`awk 'NR=='$red ./tmp/client_pocetoci`
sledna_linija=`awk 'NR=='$sleden_red ./tmp/client_pocetoci`
kunde=`awk 'NR=='$red ./tmp/kunde`
if [ $broj_linii -eq 1 ]
then
sledna_linija=`cat $input_fajl | /usr/xpg4/bin/grep -n '' | c ut -d ":" -f 1 | tail -1`
fi
taman=`expr $sledna_linija - 1`
cat ./tmp/header > ./xml/$kunde.xml
nawk -v linija="$linija" -v taman="$taman" 'NR== linija,NR== taman' $input_fajl | /usr/xpg4/bin/grep -v '' | cut -d ">" -f2 | cut -d "<" -f 1 | grep -n '@' | cut -d ":" -f 2`
perl -pi -e s/"$izbrisi"/""/g ./xml/$kunde.xml
/opt/detec/lsoft/bin/lsmain -Q LS_PDF_FILE <./xml/$kunde.xml >./tmp/1
echo $adresa",e"$kunde.pdf >> /u01/app/company/fileio/billing/efakturi/meta.txt
pomal=$broj_linii
broj_linii=`expr $broj_linii - 1`
done


[/quote]

Check GMAIL for new messages:

Here is small simple shell script for checking if there is new message arrived in your GMAIL inbox. It will show popup GUI window in your KDE GUI environment:


#!/bin/sh
user= # Enter your GMAIL username here
pass= # Enter your password
stara=0
# export https_proxy=IP:PORT # If you are using proxy, set it up here
while :
do
novi=`wget -T 3 -t 1 -q --secure-protocol=TLSv1 --no-check-certificate --user=$user --password=$pass https://mail.google.com/mail/feed/atom -O - | grep "fullcount" | cut -d ">" -f 2 | cut -d "<" -f 1`
if [ $novi -ne $stara ]
then
stara=$novi
zenity --info --title "Gmail Check" --text "You have $novi new messages"
fi
sleep 5
done

Note that if you want to run this in background, then you can choose one of two ways:

1. Insert it into crontab
2. Run it in background.