September 21st, 2005 SkyHorse I’m one of those who spent hours moving from DirectAdmin to cPanel, and in the meantime I’ve developed a couple of usefull tools to help me do it.
For the sanity of everyone ever trying to achieve this, forget googling because there is no tool available ATM. No one has ever started a script simply because the transition from DA to CP are so different that it is unthinkable.
There are scripts to move from cPanel to DirectAdmin though
I’ve started a BASH script that basically takes the files already available under the directories “backup” and “domains”, puts them nicely under one directory and tar-gzips it all. (the backup and domains directories come from untaring the User Backup created under DirectAdmin)
you then have to upload the resulting tar-gzip to the newly created cPanel account and untar-zip it. The file manager in cPanel does this with a click.
This script still has LOADS of problems, and if you’re unexperienced with the linux FS, permissions, etc… don’t come this way
What this does, however, is saving a lot of time if the accounts in question have many e-mails accounts (I did this because some of my clients had 100+ emails), and also takes care of the user files (public_html and everything else)
Resuming, this is what the script does:
- copy the quota file
- copy the IMAP folders and inbox folder of the main account
- copy the squirrelmail settings
for EACH e-mail account it does this:
- generate the entry and update the shadow and passwd file with its username and password (you keep everyone’s passwords!)
- copy the IMAP folders and inbox to the respective directory
to the domain files, it does this also:
- update references in every file (php, html, etc) by removing “domains/domain.net”
(ie /home/skyhorse/domains/skyhorse.org/public_html becomes /home/skyhorse/public_html)
This does not handle FTP settings, subdomain settings, dns settings, or anything else.
But hey, it saved me hundreds of hours of pain…
It is easily improved, so if you do, please send it back to me
BTW, the scripts assumes you’re using the SAME username in directadmin and in cpanel for each account, and the same domains as well.
It can also take a bit of hard disk space, since it literally duplicates the accounts files. If this is an issue, script around it to use the /tmp directory or even better, do some pipelining with tar
One last thing, although you see the CHMOD command being used, when untaring all files loose the damn permissions.
you NEED to change the permissions manually (inbox NEEDS to be group writable) or find a way to resolve the issue, which I couldn’t.
Here it is anyway, remember to replace the variables with your own settings:
# bash
# Copyleft (C) SkyHorse 2004
# for each account:
# put passwd as passwd + shadow
# quota (if != 0)
# into ~/etc/%domain%
GENDOMAIN=domain.com
GENUSERNAME=accuser
NEWACCPASS=accpass
MYFILESPATH=/home/skyhorse/temp_sites
mkdir result
mkdir result/mail
mkdir result/mail/$GENDOMAIN
mkdir result/etc
mkdir result/etc/$GENDOMAIN
cp $MYFILESPATH/$GENUSERNAME/backup/$GENDOMAIN/email/quota result/etc/quota
chmod 644 result/etc/quota
touch result/etc/shadow
chmod 640 result/etc/shadow
touch result/etc/passwd
chmod 644 result/etc/passwd
chmod 660 $MYFILESPATH/$GENUSERNAME/backup/email_data/imap/*
cp $MYFILESPATH/$GENUSERNAME/backup/email_data/imap/* result/mail
cp $MYFILESPATH/$GENUSERNAME/backup/email_data/pop/$GENUSERNAME result/mail/inbox
chmod 660 result/mail/inbox
mkdir result/.sqmaildata
cp $MYFILESPATH/$GENUSERNAME/backup/email_data/squirrelmail/* result/.sqmaildata
ENTRY=`cat $MYFILESPATH/$GENUSERNAME/backup/$GENDOMAIN/email/passwd`
for line in $ENTRY
do
login=`echo $line | sed s/[:].*//`
pass=`echo $line | sed s/.*[:]//`
mkdir result/mail/$GENDOMAIN/$login
mkdir result/mail/$login
echo $login:x:32120:622::/home/$GENUSERNAME/mail/$GENDOMAIN/$login:/usr/local/cpanel/bin/noshell >> result/etc/passwd
echo $login:$pass::::::: >> result/etc/shadow
chmod 750 result/mail/$GENDOMAIN/$login
cp $MYFILESPATH/$GENUSERNAME/backup/$GENDOMAIN/email/data/pop/$login result/mail/$GENDOMAIN/$login/inbox
chmod 660 result/mail/$GENDOMAIN/$login/inbox
cp $MYFILESPATH/$GENUSERNAME/backup/$GENDOMAIN/email/data/imap/$login/.mailboxlist result/mail/$GENDOMAIN/$login/
cp $MYFILESPATH/$GENUSERNAME/backup/$GENDOMAIN/email/data/imap/$login/mail/* result/mail/$GENDOMAIN/$login/
touch result/mail/$login/inbox
chmod 660 result/mail/$login/inbox
done
cp result/etc/* result/etc/$GENDOMAIN/
#domain files
cd domains/$GENDOMAIN
#update file references – this one liner deletes domains/domain.net in every file of the tree.
# efectively changes:
#/home/username/domains/domain.net/public_html into
#/home/username/public_html
find ./ -type f -exec sed -i ‘s/domains\/$GENDOMAIN\///’ {} \;
cp -R * ../../result
cd ../../result
tar –owner=$GENUSERNAME –group=$GENUSERNAME -czf ../$GENUSERNAME-$GENDOMAIN.tar.gz *
cd ..
#upload tar.gz
#I have ncftpput installed, but because most people don’t, I’ve commented it out
#ncftpput -u $GENUSERNAME -p $NEWACCPASS localhost / $GENUSERNAME-$GENDOMAIN.tar.gz
#database:
#mysql
#subdomains
#ftp
Tags:
cPanel,
directadmin,
Downloads,
hosting,
Programming,
scripts,
Web Design,
WHMRelated posts:
Posted in Downloads, Programming, Web Design | No Comments »
August 11th, 2005 SkyHorse After been involved in web marketing for years now, right from when arranging your website for a better exposure to a search engine was one of those great breakthroughs no one had thought about before, I stumbled upon a new and quite interesting way to promote your website and products.
This latest trend I have spotted, after the one where you do mass-commenting on blogs and include your website’s URL, is to place your URL on other website’s statistics logs.
A year ago I remember having a look through one of my website’s referrals statistics (something I do regularly, as any self-respecting webmaster does) and spotted one interesting referral site that I had not expected and would not believe it would be possible for my link to exist there. It was from a reputable on-line casino website. Now, I thought, perhaps our visitors have our website open at the same time they visit their casino (sometimes this messes up the ‘referral’ header in a browser).
Today, I noticed around 100 different online poker rooms being ‘referrals’ on most of my websites. To be fair, it doesn’t really make any sense these being web marketing strategies because no one, and specially no search-engine, is going to see my site’s stats. Then again, I know there are many sites where the statistics are freely available and that could represent a fair chunk of the personal sites out there. Without a context-aware algorithm, search engines will simply presume these sites are ‘linking’ to the online poker rooms and therefore increase their results on a web search (Google is the easiest target for this kind of strategy). That is a pretty clever, if not outrageous, way to improve your sites ranking.
There is another possibility though which is based on the fact that most web masters will visit any ‘interesting’ looking URL’s on their website’s referral statistics. Now, considering web masters will probably spend most of their time online and probably fit into your average Poker player profile, could this mean this is all about getting *them* to use their poker room? It would make a lot of sense.
I am really curious now so if anyone has any idea about why this is happening (at a frightening pace, may I add) please let me know :) (I should probably be looking into spamming web sites statistics with my web hosting company! That would work, wouldn’t it? :P )
Tags:
Ideas,
Web Design,
web-marketingRelated posts:
Posted in Ideas, Web Design | No Comments »
August 1st, 2005 SkyHorse Some web applications, like my own cPanel and Web Mail, use non-standard tcp ports. Usually this is because they are part of a software package that runs alongside Apache but does not use it to serve the pages.
Problem is many corporate and university firewalls do not allow access to ports such as 2095 and makes all the neat web apps like the ones above completely useless until you get home (where you probably have some other e-mail software anyway).
For some time I have used a simple port redirector installed on my home computer which allowed me to see my e-mails from my work place and my university. This is a bit annoying, though, because not only I have to leave my pc on the all day just for this but also because it is a slower connection and I am the only one who can use it (yes, I am thinking about my own hosting clients/partners who complain about the same problem).
So, I am starting a journey to make a ‘transparent’ PHP application that can successfully accept an incoming HTTP connection, grab the headers and open a server-side connection to another service and use the incoming headers for the request. Upon reception of the response, the script must alter *all* tags to its own name and append a single GET variable with the original href.
Thus, on a simple page, where there is a:
<a xhref="www.skyhorse.org/abc.html?I=rule" mce_href="www.skyhorse.org/abc.html?I=rule">
there will be a:
<a xhref="redirector.php?requestedURL='www.skyhorse.org/abc.html?I=rule'" mce_href="redirector.php?requestedURL='www.skyhorse.org/abc.html?I=rule'">
.
I still don’t know if the use of ‘ or even ” will be tolerated by the HTTP request, but I think as a last resort I can always do some kind of two-way encoding (like base64 or something similar) to encode the original request in an AsciiSimple format.
For now, I have some proof of concept working (yikes, I can open a server-side socket in PHP!) but I am still a long way before I turn off my home computer during the day :)
If anyone has any information on how to accomplish what I am trying to do, please, do give me a shout :)
– Update 1
After some time I discovered another major issue: Images!
I think I will have to make a standalone script or function in PHP just to handle the redirection of images… yes, because there has to be a request for images to a PHP script and those images have to be quested server-side and returned… mmm … maybe not that complicated, just a redirect.php?requestImage=originalURL and the request.php will take care of returning just the binary information taken directly from the server-side connection made to the service… could work… will work!
–Update 2
Ok, so, I finally discovered I was re-inventing the wheel…
I had already looked for this on the web, but couldn’t find anything. But now I stumbled upon cpanelproxy .
It does exactly what is says on the label: server-side proxy to cPanel.
It’s funny how the script I was writting was starting to look like the script they made! Unfortunatelly it does not yet support SSL, perhaps I could find a way to implement it, but I think it would be almost impossible…
Tags:
cPanel,
Ideas,
Programming,
Web Design,
WHMRelated posts:
Posted in Ideas, Programming, Web Design | No Comments »
May 11th, 2005 SkyHorse I couldn’t stop laughing at this one… but they do struck a chord at one important issue: on what reasons do you vote for a particular party? (and for those NationStates afficionados, “none of the above” is *not* a valid answer)
For that geek web designer inside you, here’s an idea: vote for the party with the better markup-coding ability. (like they said, people vote for far less important reasons)
Here’s the result for the recent UK general election:
The Scottish National Party: 0 errors (XHTML 1.0 Transitional)
The Conservative Party: 0 errors (XHTML 1.0 Transitional)
The Labour Party: 1 error (XHTML 1.0 Transitional)
The Green Party: 5 errors (no DOCTYPE or character encoding, HTML 4.01 Transitional used)
Plaid Cymru: 9 errors (no DOCTYPE or character encoding, HTML 4.01 Transitional used)
Veritas: 11 errors (no DOCTYPE or character encoding, HTML 4.01 Transitional used)
Respect: 26 errors (no DOCTYPE, HTML 4.01 Transitional used)
The Liberal Democrat Party: 148 errors (XHTML 1.0 Transitional)
UKIP: 161 errors (apparently, an attempt at HTML 3.2)
Lets just say if this country was made up of web designers, I would be prime-minister by now ;)
The original laugh:
Industrial & Marine | Blog: Parse-y Political Broadcast
Tags:
Ideas,
Personal,
Web DesignRelated posts:
Posted in Ideas, Personal, Web Design | 1 Comment »
May 8th, 2005 SkyHorse It wasn’t enough for the WWW to have to take up with Macromedia’s Flash and Adobe’s PDF Reader loading times, we will probably see more of them if Adobe goes ahead with the promise of increasing “complementary functionality of PDF and Flash” by acquiring Macromedia…
About Adobe – Adobe to acquire Macromedia
Lets pray for the new version of Dreamweaver to not be called DreamLive CS2 …
Tags:
Web DesignRelated posts:
Posted in Web Design | No Comments »