IndianWebPortal.com

Something Different In Linux

Home » Archive by category 'Shell Programming and Scripting'

How to find out the reseller name with domains? Ans : If you want to list all cPanel accounts under a specific reseller, then you can use the below simple shell script. 1) Crete the file reseller.sh and add the following code. vi /home/reseller.sh ========================================================== #!/bin/bash usage() { echo “Example : $0 domain.com or username”  [ Read More ]

Following are the steps to take increment backup of reseller account on backup server. 1) First we need to find out the user name which is under the reseller account. On shared/source server :- vi /home/resellerUsername/backup.sh # For finding the username under the reseller account cat /etc/trueuserowners | grep resellerUsername | awk -F: ‘{print $1}’  [ Read More ]

It’s always a good practice & from the security point of view to get notified instantly through an email when someone logs into your server through SSH with root privileges. Open the file .bashrc for the root user. Vi /root/.bashrc enter the following code into echo ‘SSH Root Access (Your Server Name) on:’ `date` `who`  [ Read More ]

Make your shell colorful

Posted by Rishikesh Vispute Categories: Basic Linux, FUN, Shell Programming and Scripting

You can easily changed your black ssh screen to colorful screen by using following steps. 1) Login to the server via SSH as root 2) Edit the .bash_profile file found in the /root directory & paste the following line: vi  .bash_profile export PS1=”\[$(tput bold)$(tput setb 4)$(tput setaf 7)\]\u@\h:\w $ \[$(tput sgr0)\]” Save & quit the  [ Read More ]

Some common script

Posted by Rishikesh Vispute Categories: Shell Programming and Scripting

1 ) Script to change server wide ownership for all cpanel users. ==================== #!/bin/bash cd /var/cpanel/users for user in * do chown -Rv $user.$mail /home/$user/etc chown -v $user.$nobody /home/$user/public_html chown -Rv $user.$user /home/$user done ====================

If you want to set the expiration to your site   means after some date or year your site shows custom error on the page then you can add following code in index page below the “<?php” code  and set the date as per your request. ============================================ $exp_date = “2010-04-31″; $todays_date = date(“Y-m-d”); $today =  [ Read More ]

How to set correct ownership to all account on the cPanel server. You can use the following commands to set the correct ownership for all accounts which is hosted on the cPanel server. =============================== for i  in `cat /etc/trueuserdomains   | awk ‘{print $2}’` > do > chown $i.$i /home/$i -R; > chown $i.mail /home/$i/etc -R;  [ Read More ]

test cgi script

Posted by Rishikesh Vispute Categories: Knowledge, Shell Programming and Scripting

Create one test.cgi file and add the folloing test code for checking the .cgi file working on the server. ======================= #!/usr/local/bin/perl # hello.pl — my first perl script! print “Content-type: text/html\n\n”; print “Hello, world!\n”; =======================

some IMP script

Posted by Rishikesh Vispute Categories: Shell Programming and Scripting

1) Script for finding username from /etc/trueuserowners file and save it user.txt file cat /etc/trueuserowners | awk ‘{print $2}’ > user.txt or cat /etc/trueuserdomains | awk ‘{print $1}’ > user.txt 2) Script for remove .htaccess or any file from current(.) directory find . -name .htaccess | xargs rm -rf

If you want to migrate more accounts from one server to another server then you need to create packages for each accounts . You can easilly create packages by using this script. 1) Create one Migarting-Accounts.txt file and add the the user name , which you want to create packages. 2) Create Migration directory for  [ Read More ]

Popular Posts

remove index.php fro

How to remove index.php from url in magento Ans : If you ...

PHP-Java bridge on p

  What is php-java bridge? The php-java bridge is the php ...

Set expiration for y

If you want to set the expiration to your site ...

Warning: Parameter 1

Error: Warning: Parameter 1 to modMainMenuHelper::buildXML() expected to be a ...

domain pointing to e

If you domain uses external MX record and it is ...