buy tadalafil

Archive for the ‘Shell Programming and Scripting’ Category

set correct ownership to all accounts

Wednesday, January 13th, 2010

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;
> chown $i.nobody /home/$i/public_html;
> done;

===============================

test cgi script

Wednesday, November 25th, 2009

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

Friday, November 13th, 2009

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

Script for create package on cpanel server

Friday, November 13th, 2009

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 to move all the cPmove files from /home directory to Migration directory.

then use following command to create cpmove packages and moved to “Migration” directory.

for i in `cat /home/Migarting-Accounts.txt`;do /scripts/pkgacct $i; mv /home/cpmove-$i.tar.gz /home/Migration/;done

or

===========================

For migrating Reseller and/or Bulk accounts between cpanel servers::

For Reseller::

cat /etc/trueuserowners  | grep username | awk '{print "/scripts/pkgacct "$1}'

OR

1. cat /etc/trueuserowners  | awk '{print $1}' > 1.txt

then remove the sign “:” from 1.txt
for i in `cat 1.txt`;do /scripts/pkgacct $i; mv /home/cpmove-$i.tar.gz /home/Migration/;done

Then move the “Migration" folder and 1.txt file to remote server and by using following command restore all the accounts.

for i in `cat 1.txt`;do /scripts/restorepkg $i;done

===========================