Friday, December 7, 2012

How to install java/jdk using WHM/Cpanel from RPM

If you simply want JDK and JRE just to run Java programs and also compile them then just go to in WHM : Software-> Install RPM and select from the list:

java-1.7.0-openjdk-devel

When you install the browser spits a bit of information.

On my Centos it is installed on something like /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/bin

So just add this path in .bashrc :

export PATH=$PATH:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/bin

And then save it and run ". ~/.bashrc". Now you can type command java/javac etc.

So instead of install complete Tomcat server, this is simple way to install java using WHM/Cpanel.

Monday, November 19, 2012

Webhosts providing Semi-dedicated plans

I'm looking for shared high bandwidth hosting( also called semi-dedicated or enterprise web hosting) as my sites have exceeded shared hosting on Hostgator Baby plan. Here is some list I've prepared for quick reference.

Instead of moving to VPS it is better to see if any semi-dedicated web hosting plan can manage your site/sites. If it is, then nothing like it!

Managing VPS is not recommended as it requires management of lot servers, anti-spam techniques, security features etc. Remember all need to be done from scratch. Another hassle is that you will not have secondary name server and you'll need to make arragements to get make one. And if your single server stops working you all name resolution of all sites will fail and even email will bounce.

I've selected these companies as they look convincing. If you know any else then please let me know by placing them in comments!

Ntchosting

(www.ntchosting.com)

  • Cost: $35/$55
  • 24x7 support : Chat is supported
  • Backup: Daily
  • Max CPU Usage (per CPU) : 20%
  • Alexa : 19,000

Reseller Panel

(www.resellerspanel.com/semi-dedicated-servers/semi-dedicated-1.html)

  • Cost: $25
  • 24x7 support : Chat,Phone
  • Backup: Daily
  • Max CPU Usage (per CPU) : 30% CPU share and up to 90000 MySQL queries per hourAlexa : 19,000
  • Plan Pricing: Monthly
  • Control Panel: Hepsia
  • Alexa: 13400

Hawk Hosting

(www.hawkhost.com/semi-dedicated-hosting)

  • Cost: $20 and more
  • No Chat support
  • 50 mysql connections, 20 processes max(max 7 php)
  • Real 99.9% Uptime Guarantee
  • Cpanel
  • Alexa: 8200

MDD Hosting

(www.mddhosting.com)

Coupons of 50% discount available online

  • Cost: $25 and more
  • No Chat support
  • Cpanel
  • Maximum of 10 processes allowed
  • Alexa: 104000

Stable Host

(www.stablehost.com/enterprise-hosting.php)

Coupon of 50% discount available online

  • Cost: $20 and more
  • CPU/Ram X 4 times of normal
  • maximum 50 concurrent mysql connections, 25 concurrent processes
  • No Chat support
  • Alexa: 18600
Feature Shared Enterprise
Support Methods 24/7/365 Email Only 24/7/365 Phone/Email
Priority Support [More Info] No Yes
Accounts per Server 500+ 100
INODES/Files 250k 500k
CPU 15% of 1 CPU Core 100% of 2 CPU Cores
MySQL Connections 10 50
SLA 99.9% (43.2 minutes of downtime per month) 99.99 (4.32 minutes of downtime per month)
Script Troubleshooting No Yes
Hacked / Compromised Repair No Yes

Site Ground

(www.siteground.com/semi_dedicated_hosting.htm)

Hardly any coupons available

  • Cost: $30 and more
  • Chat support
  • Alexa: 2000

Glow Host

(http://glowhost.com/web-hosting-service/semi-dedicated-server-plans.html)

Hardly any coupons available

  • Cost: $70
  • No Chat support
  • Cpanel
  • Alexa: 79,000

I raised a ticket asking for the resource usage limits in Semi-dedicated server plan. This is what I got in the reply:

Here are no strict limits, all limits are depend on a server specification. Usually max mysql connections is set to 100, you can set memory limit on your own, but it shouldn't be more than RLimitMEM limit (usually this limit is 512 or more on Semi-Dedicated servers). You can read more about Semi-Dedicated plan here.

Sunday, September 30, 2012

How to send smtp mail in Perl on Shared Hosting(esp Hostgator) with authorization

Looking to send email using Perl in Smtp in Shared hosting( this is tested for Hostgator) on Centos/Linux/Unix?
This code does that. If you're on Hostgator Centos shared hosting server then this works:
#!/usr/bin/perl

use Net::SMTP;

$smtp = Net::SMTP->new('mail.mysite.com');
$smtp->auth( 'contactus+mysite.com', 'rmypassword' );
$smtp->mail('contactus@mysite.com');
$smtp->to('ragmyemail@gmail.com');

$smtp->auth( 'contactus+mysite.com', 'passowrd' );
$smtp->data();
$smtp->datasend('ragmyemail@gmail.com');
$smtp->datasend("From: Whats up?\n");
$smtp->datasend("To: Whats up?\n");
$smtp->datasend('Subject: Whats up1?');
$smtp->datasend("\n");
$smtp->datasend("Hello, this is test email.\n");
$smtp->dataend();

$smtp->quit;

Wednesday, February 8, 2012

How to email backup shared hosting site mysql database automatically


 Here is the bourne shell script on my Centos unix Hostgator shared hosting server placed in the crontab and runs once in a day at 3am my country time.

#!/bin/sh

cd /home/myname/www/tmp/all


mv *.sql j
rm *.gz

for i in  *dump*.sh
do
if ! sh $i
then
echo "Failed for $i"
exit
else
echo "$i success"
fi
done
d=`date|tr " :" --`
echo $d

ls -l *.sql

echo "Total files=" `ls -l *.sql|wc -l`
file="scripts.tar"
if ! tar cvf $file   *.sh *.php
then
echo "tar for file:$file has failed"
exit
fi
if ! gzip -9 $file
then
echo "gzip for file:$file has failed"
exit
fi
echo "...........................Success .... see the file below:"
ls -lh "$file.gz"


for i in *.sql
do
if ! gzip -9 $i
then
echo "gzip for file:$i failed"
exit 1
fi
done


echo "Emailing it"


for i in *.gz
do
if ! php email.php "$i"
then
echo "Email failed for $i"
fi
done

echo "Email sent successfully"
exit 0

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

Content on my sample mysqldump_adi.sh

mysqldump -h localhost   -u <dblogin> <dbname> -p<dbpasswd> outfile.sql
-------------------------------------------
Email.php: Here is the source code to send files by attachment using Smtp in Php.