Sunday, June 26, 2016

Happiness

Happiness

What is happiness. It differs person to person. Many say Money is not happiness but how can you define it for others. May be money give happiness to some. In this world we cannot define anything with one rule. Majority of people may believe money may not be a source of happiness but even for them money indirectly brings happiness.
                            People may act like they got happiness is because of truth but in fact there must be a  price they should have payed for that truth. Money is not matter currency always. It differ place to place.
Some time gold, sometime it may be some some exchangeable goods like a toy or jewel or electronic or cloth or place or anything. This list may grow infinitive but without money there is nothing named happiness in this world............................

Friday, November 22, 2013

Script to Manipulate virtual host

The Script was created to create multiple virtual hosts in Apache.

1.txt
lrppiwcwbpb powcwbpb
lrppiwcwbpd powcwbpd
lrppiwcwbpf powcwbpf
lrppiwcwbph powcwbph


sam.conf
   DocumentRoot "htdocs/powcwbpb"
   ServerName lrppiwcwbpb
   ErrorLog "logs/lrppiwcwbpb-error_log"
   CustomLog "logs/lrppiwcwbpb-access_log" common
   DocumentRoot "htdocs/powcwbpb"
   ServerName lrppiwcwbpb
   ErrorLog "logs/ssl_lrppiwcwbpb-error_log"
   CustomLog "logs/ssl_lrppiwcwbpb-access_log" common


sc.sh
while read line           
do
dnsname=`echo $line|cut -d" " -f1`
instance=`echo $line|cut -d" " -f2`
cat sam.conf | sed -e 's/lrppiwcwbpb/'"$dnsname"'/;s/powcwbpb/'"$instance"/'' > conf.d/"$instance".conf
done < 1.txt

Tuesday, July 17, 2012

FTP test windows script

The below batch file FTPtest.bat will call the Test.scr / Test2.scr / Test2.scr to test the ftp site continuously.

 FTPtest.bat 

 @echo ON 
FOR /L %%n IN (1,1,20000) DO ( 
ftp -s:Test1.scr 
) >> out1.txt 2>&1 

Test.scr 

open ftpserver 
ftpserver\username 
password 
!echo %time% 
cd /temp 
!echo %time% 
bye 

Test1.scr

open ftpserver 
ftpserver\username 
password 
!echo %time% 
cd /data/d/prod 
!echo %time% 
cd /temp1/d/prod 
!echo %time% 
bye 

Test2.scr 

open ftpserver 
ftpserver\username 
password 
cd test 
mput GDF.zip 
delete GDF.zip 
bye

Monday, May 30, 2011

Sunday, May 29, 2011

Log Rotation Script

Simple Log rotation

#!/bin/bash
F1=/apps/apache/logs/access_log
F2=/apps/apache/logs/error_log
F3=/apps/apache/logs/server1.log
timestamp=`date +%Y%m%d`

for i in $F1 $F2 $F3
do
newlogfile=$i.$timestamp
/bin/cp $i $newlogfile
> $i
/usr/bin/gzip $newlogfile
done


Log rotation based on File size

#!/bin/bash
F1=/apps/apache/logs/access_log
F2=/apps/apache/logs/error_log
F3=/apps/apache/logs/server1.log
timestamp=`date +%Y%m%d`

for i in $F1 $F2 $F3
do
logfile=`ls -ltr $i | awk {' print $5'}`
newlogfile=$i.$timestamp
if [ $logfile -gt 5000000 ]; then
/bin/cp $i $newlogfile
> $i
/usr/bin/gzip $newlogfile
fi
done

One more New
#!/bin/bash
timestamp=`date '+%m%d%Y_%H'`
serverlogloc=/apps/symc/domains/crs/servers

for i in `ls -l $serverlogloc| grep '^d'|awk '{print $9}'|grep -v domain_bak`
do

if [ -f $serverlogloc/$i/logs/$i.out ]
then
size=`ls -l $serverlogloc/$i/logs/$i.out | awk '{print $5}'`
if [[ $size -gt 5120000 ]]
then
newlogfile=$serverlogloc/$i/logs/$i.out.$timestamp
cp -p $serverlogloc/$i/logs/$i.out $newlogfile
> $serverlogloc/$i/logs/$i.out
fi
fi

done

Followers