Scalar Variable in Perl

 

Hello,

 

The following post will explain you the rules and example to use scalar variable in perl language.

Rules:
Scalar variable can be used to define single or multiple values.

 

Here in the following example, I have declared the variable $firstname, $lastname and $age as single value and $Designation as multiple values inside “” double quotation.

#!/usr/bin/perl -w
# Example script to declare Scalar variable

$firstname = "Siranjeevi";
$lastname = "Rajendran";
$age = 24;
$Designation = "Systems Engineer";
print "$firstname $lastname with age $age is working as $Designation\n";

#END

The output would be

Siranjeevi Rajendran with age 24 is working as Systems Engineer

Thank you for viewing helpinlinux.com

Dump All MySQL Databases Starting with Prefix

 

Hello,

 

The following shell/bash script will help you in taking backup of databases starting with prefix.

 

#!/bin/bash
#Script for mysql database backup

cd /var/lib/mysql
#Path to mysql folder I am using default path here
for DBs in $(ls -d */ |grep dbprefix_ | tr -d /)
do

cd /mysqlbackup

`mysqldump -u root -p'password' $DBs > $DBs.sql`


done

Escape Character in Perl example Script

 

Hello,

 

The script below explains on how to use escape characters in a perl environment

1. Perl will escape back slash “\” by default so if you referring a path to a windows system please make sure that you use two back slashes to refer one \

Eg: c:\\windows upon compilation will be referred as c:\windows

2. To preserve ” and “” from being executed we can use single “q” with braces like q{}, in other words q{} is similar to ” in perl enviroment where contents inside ” will not be executed and double “q” with braces like qq{} will execute the contents inside the braces just like “” where conents inside “” will be executed. The below script will explain you better.

#/usr/bin/perl -w
#Escape character for perl
print "c:\\windows ", 'This will print the string as c:\windows', "\n";
print q{This will preserve '' and "" without being compiled}, "\n";
print qq{This will compile contents between the braces\n};

The output of above perl script will be

c:\windows This will print the string as c:\windows
This will preserve '' and "" without being compiled
This will compile contents between the braces




Cannot register service: RPC: Unable to receive; errno = Connection refused

 

Hello,

Cannot register service: RPC: Unable to receive; errno = Connection refused

You are getting the above error while starting your NFS service because you have not installed or started rpcbind service.

 

Solution:

======

yum -y install rpcbind

and start the service

 /etc/init.d/rpcbind start

suphp plesk alternative mod_ruid2 wordpress upload permission issue

 

So, you finally came here finding an alternative solution for your Plesk server for wordpress and other CMS for uploading files via web server. I will help you solving the issues, the alternatives for suphp are mpm-itk and mod_ruid2, I tried configuring mpm-itk in the plesk server but it was not supported properly, there were few sites which were diplaying blank page, so I prefer mod_ruid2 over mpm-itk for plesk environment.

First download the atomicorp repository if you dont have the latest one using the below commands. This may over write the current atomic repostory

cd /root
wget http://www.atomicorp.com/installers/atomic
chmod +x ./atomic
./atomic

Then download the apache module mod_ruid2 via yum

 yum install mod_ruid2

then edit the config file at /etc/httpd/conf.d/ruid2.conf and add the below similar configuration into it.

<Directory /var/www/vhosts/domain.com>
RMode stat
RUidGid ftpuser psacln
RGroups psaserv
</Directory>

save the file and restart apache service.

/etc/init.d/httpd restart

That’s it you are done, make a note that you need to manually add all the domain name where you need to run the website on it’s own username. Not sure if there is any other alternative to automate it.



OpenVZ Command Line Reference Configuration Files

 

Hello,

 

The following tutorial will help you with managing OpenVZ main node.

Commands to manage OpenVZ:
======================
1. “vzlist” will list all the containers present in the main node.
2. “vzctl” will have alot of options like below.
vzctl enter will allow you to enter into the respective container.
vzctl restore [–dumpfile ] will allow you to restore the dump file
with the container ID.
vzctl destroy will allow you to delete the respective container.
vzctl start will allow you to start the respective container.
vzctl stop will allow you to stop the respective container.
vzctl restart will allow you to restart the respective container.
vzctl create [–ostemplate ] [–config ] will allow you to
create a container with the specified CTID OS and config file.

 

OpenVZ file paths:
=============
1. All container datas,templates,dumps will be located in /vz/ by default.
2. Container OS templates are all stored in /vz/template/cache/.
3. Container datas will be stored in /vz/private/
4. Container lock files will be stored in /vz/lock/.lck




Thank you for viewing helpinlinux.com

This entry was posted in VPS.

cpanel exim stop spam

 

Hello,

The following cPanel/Exim configuration will help you stopping spam in the server.

1. Login to WHM control panel
2. Goto Main >> Service Configuration >> Exim Configuration Manager
3. Enable RBL filtering by Basic Editor >> RBLs >> switch to “On” and if you like you may additional RBL from manage option.
4. Enable Sender Verification by Mail >> Sender Verification >> “On” this will check if the mail origin really exists.
5. Reject SPF failures by ACL Options >> Reject SPF failures >> “On” this will verify SPF records and if the SPF record is set to fails then the E-mails from those IPs will be rejected.
6. Home >> Server Configuration >> Tweak Settings
7. Turn “Initial default/catch-all forwarder destination” to “fail” this will fail the catch all feature to be sent to default cPanel account.
8. “Set Max hourly emails per domain” which will limit the E-mail flooding from the server(I normally set it to 70 which is good enough for a single domain for an hour).
9. Set “Maximum percentage of failed or deferred messages a domain may send per hour” everyone knows that Spam E-mails will have alot of non existing E-mail which will then be deferred  so If we set this to say 50% the spamming E-mail account will be suspended temporarily if the deferred mails are above 50%.

10. Then save all the configuration this will stop most of spams in the server.

 



 

Thank you for viewing helpinlinux.com

cpanel to cpanel transfer

Hello,

 

You can follow the below steps to migrate websites from a cPanel server to cPanel server via whm root password.

 

1. Login to the control panel https://destinationhost.com:2087
username: root
password: whmrootpassword

2. Select –> Transfers –> Copy an account from another server

3. Fill the following details.
a. Remote Server Type: WHM/cPanel
b. Remote Server Address: xx.xx.xx.xx
c. Remote SSH port: 22
d. Username to Copy: (accountname)
e. Login (Select Root)
f. Root Password: sourceserverpassword

4. Select Transfer Account and wait untill the page completely loads, and you get the below output.

Restore Complete
Account Restore Complete Unlocking password for user accountname.passwd: Success.

Removing Copied Archive on remote server…. Done

Transfer Complete
Account Copy Process Complete




 

Solusvm Templates OpenVZ Add

 

Hi,

 

You can add templates to your solusvm control panel on your OpenVZ server, you may follow the below steps to add it.

 

1. You may download the operating system in tar.gz format at http://ftp.openvz.org/template/precreated/contrib/ and then upload them to /vz/template/cache .

2. Then login to your solusvm control panel using admin user at http://xx.xx.xx.xx:5353/admincp

3. Then select  Dashboard –> Media –> Add OpenVZ Template

4. Now, you will have options like “Name, Description, etc. fill that and select the downloaded template at “Template” drop down.

5. Select the downloaded template arch and select “ADD TEMPLATE

 

That’s it you have completed adding a OS template in SolusVM, you may use this newly added template to reinstall your guest OS.

 



Thank you for viewing http://helpinlinux.com