Current time: 11-23-2024, 06:56 PM Hello There, Guest! (LoginRegister)


Thread Closed 
[HOWTO] Using the CLI to manage ispcp via command line (scripts)
Author Message
adam Offline
Junior Member
*

Posts: 12
Joined: Aug 2008
Reputation: 0
Post: #31
RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts)
Hi Aseques!

I have a little problem with your CLI script, because I can't create FTP account.

My system: Debian 5.0, ISPCP 1.0.3-1

Message:
host:/home/server3/cli# php domain.php --action create_ftp --domain "teszt.com" --password "vfmkr4321"
Creating the default FTP user for teszt.com

Fatal error: Call to undefined function chk_username() in /home/server3/cli/ftp_add.php on line 307

Thank you!
02-08-2010 06:17 AM
Find all posts by this user
aseques Offline
Member
*****
Dev Team

Posts: 330
Joined: May 2008
Reputation: 4
Post: #32
RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts)
(02-08-2010 06:17 AM)adam Wrote:  Hi Aseques!

I have a little problem with your CLI script, because I can't create FTP account.

My system: Debian 5.0, ISPCP 1.0.3-1

Message:
host:/home/server3/cli# php domain.php --action create_ftp --domain "teszt.com" --password "vfmkr4321"
Creating the default FTP user for teszt.com

Fatal error: Call to undefined function chk_username() in /home/server3/cli/ftp_add.php on line 307

Thank you!
Ok, I just saw I forgot to attach the ftp_add in the tar.gz, I just added it with the current version of the script.
Please re-download it and tell me in case it's not working.
I am using it on a lenny + 1.0.3.1 version without problems.
02-08-2010 07:11 PM
Find all posts by this user
adam Offline
Junior Member
*

Posts: 12
Joined: Aug 2008
Reputation: 0
Post: #33
RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts)
Hi!

I download it and extracted, but the domain.php and ftp_add.php is the same.

-rwxr-xr-x 1 server3 server3 12666 2010-02-08 10:01 domain.php
-rw-r--r-- 1 server3 server3 12666 2010-02-08 10:05 ftp_add.php

It is correct?

Thank you!
02-09-2010 01:48 AM
Find all posts by this user
aseques Offline
Member
*****
Dev Team

Posts: 330
Joined: May 2008
Reputation: 4
Post: #34
RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts)
(02-09-2010 01:48 AM)adam Wrote:  Hi!

I download it and extracted, but the domain.php and ftp_add.php is the same.

-rwxr-xr-x 1 server3 server3 12666 2010-02-08 10:01 domain.php
-rw-r--r-- 1 server3 server3 12666 2010-02-08 10:05 ftp_add.php

It is correct?

Thank you!
Sorry, it was wrongly packaged again Sad it should be fine now ...
02-09-2010 02:38 AM
Find all posts by this user
rethus Offline
Junior Member
*

Posts: 202
Joined: May 2009
Reputation: 3
Post: #35
RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts)
I'm very very glad to see the nice work you're done.
I wan't to migrate from Plesk 9.3 to ispCP (newest stable version).

Can u give a short overview how you did your plesk-Migration?
Did you have a bash-script which connect to the plesk-server, or to the plesk-database to get all the informations automaticly?

PS: Have start to translate your wiki-page to german-language.
(This post was last modified: 02-21-2010 09:29 PM by rethus.)
02-21-2010 09:05 PM
Find all posts by this user
aseques Offline
Member
*****
Dev Team

Posts: 330
Joined: May 2008
Reputation: 4
Post: #36
RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts)
(02-21-2010 09:05 PM)rethus Wrote:  Can u give a short overview how you did your plesk-Migration?
Did you have a bash-script which connect to the plesk-server, or to the plesk-database to get all the informations automaticly?
We had to create some php scripts to accomplish the migration.
1.- You should stop the incoming mail for the domain, and the website, we did this changing the mx transport, and changed the index.php of the sites with a warning about the job being done.
2.- Another php prepared for use the list of the comands domain.php and domain_dns.php should run to replicate the domain. Basically you can get all that information from the database (in plesk the passwords are on clear text)
3.- Finally you run the scripts in order, for example.
.- Create the domain on ispcp
.- wait for it to be finished
.- rsync the content from plesk to ispcp
.- create the database and the mysql users
.- rsync the databases (normally syncing /var/lib/mysql and restarting the mysql server does the trick)
.- create the mail accounts
.- rsync the mail from plesk to ispcp (was using dovecot in my case)
and so on...
4.- At the end you will have the new server ready to run, then you must change from the old server to the new one the dns service.
5.- Domain finished, and then for the next (I did around 300 domains, but most were quite simple)
02-22-2010 05:07 AM
Find all posts by this user
rethus Offline
Junior Member
*

Posts: 202
Joined: May 2009
Reputation: 3
Post: #37
RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts)
(02-22-2010 05:07 AM)aseques Wrote:  
(02-21-2010 09:05 PM)rethus Wrote:  Can u give a short overview how you did your plesk-Migration?
Did you have a bash-script which connect to the plesk-server, or to the plesk-database to get all the informations automaticly?
We had to create some php scripts to accomplish the migration.
1.- You should stop the incoming mail for the domain, and the website, we did this changing the mx transport, and changed the index.php of the sites with a warning about the job being done.
2.- Another php prepared for use the list of the comands domain.php and domain_dns.php should run to replicate the domain. Basically you can get all that information from the database (in plesk the passwords are on clear text)
3.- Finally you run the scripts in order, for example.
.- Create the domain on ispcp
.- wait for it to be finished
.- rsync the content from plesk to ispcp
.- create the database and the mysql users
.- rsync the databases (normally syncing /var/lib/mysql and restarting the mysql server does the trick)
.- create the mail accounts
.- rsync the mail from plesk to ispcp (was using dovecot in my case)
and so on...
4.- At the end you will have the new server ready to run, then you must change from the old server to the new one the dns service.
5.- Domain finished, and then for the next (I did around 300 domains, but most were quite simple)

Thanks for this Information.
But did you have done these steps (at point 3) manualy or did u create a bashscript on the target-Machine.

Please can u sent little example-commands for creating domain, mysql-database, mails ?
02-23-2010 10:07 PM
Find all posts by this user
aseques Offline
Member
*****
Dev Team

Posts: 330
Joined: May 2008
Reputation: 4
Post: #38
RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts)
Quote:But did you have done these steps (at point 3) manualy or did u create a bashscript on the target-Machine.
I created/exchanged a openssh keypair, so I coud execute something like:
ssh root@new_server "/root/scripts/domain.php --action create_domain --domain example.com --password 9g2jsg"
This way I was able to create the domain from the old server.
After that, a "rsync -ave /var/www/vhosts/example.com/httpdocs root@new_server:/var/www/virtual/example.com/htdocs"
Then a --action fix_permisions

That would be to create the web part, test it properly.
Quote:Please can u sent little example-commands for creating domain, mysql-database, mails ?
Just have a look at the wiki, also the script when execute gives you all the alernative commands.

Oh, also have a look at TODO comments, some might be important.
02-24-2010 12:41 AM
Find all posts by this user
rethus Offline
Junior Member
*

Posts: 202
Joined: May 2009
Reputation: 3
Post: #39
RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts)
Now i have a Problem with your scripts.If i try to execute the domain.php command, i got this error:

Quote:Warning: require_onece(getopts.php): failed to open stream: bno such File or directory...

So the script dont find that File getopts.php... and there was no file into your scripts_package.

Can you give me a hint?
I have found the missing Script here:
http://hash-bang.net/wp-content/plugins/...etopts.php

Would be great if yout could put it into your script-package.
(This post was last modified: 03-17-2010 08:24 AM by rethus.)
03-17-2010 08:11 AM
Find all posts by this user
rethus Offline
Junior Member
*

Posts: 202
Joined: May 2009
Reputation: 3
Post: #40
RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts)
I have found a little bug into your scripts. Not an prgramming-bug... itsw an logical BUG.

I have installed ispCP and configured it to only set hosting-plans on Admin - not on Reseller.
If i use your Script, i have to add --created_by and --hosting_plan. And its only works, if the Hosting_Plan was created by the user who is named on --created_by.

But this is no logical assignment. Cause if i add all my plesk-customers i had to add them to the admin (cause reseller don't have own hosting_plans.

But ispCP don't can assign users from (or to) admin. This is also a logical misstake of ispCP, cause a user have to be also assignable from reseller back to admin... or from admin to reseller....

I solve my Problem with changing your domain.php...

Change this line:
Code:
$result = $mysqli->query("SELECT `props` FROM `hosting_plans` WHERE `name`='$hosting_plan' AND `reseller_id`='$created_by'");

into:

Code:
$result = $mysqli->query("SELECT `props` FROM `hosting_plans` WHERE `name`='$hosting_plan'");

So my next Question is... how did you set all the User-Details (adress, name and so on)?
I see some variables into your script, but seems they doesn't accessaible from outside?
(This post was last modified: 03-17-2010 09:43 AM by rethus.)
03-17-2010 09:40 AM
Find all posts by this user
Thread Closed 


Forum Jump:


User(s) browsing this thread: 3 Guest(s)