ispCP - Board - Support
[HOWTO] Using the CLI to manage ispcp via command line (scripts) - Printable Version

+- ispCP - Board - Support (http://www.isp-control.net/forum)
+-- Forum: ispCP Omega Contributions Area (/forum-40.html)
+--- Forum: Howtos (/forum-41.html)
+--- Thread: [HOWTO] Using the CLI to manage ispcp via command line (scripts) (/thread-4255.html)

Pages: 1 2 3 4 5 6 7


RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts) - adam - 02-08-2010 06:17 AM

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!


RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts) - aseques - 02-08-2010 07:11 PM

(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.


RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts) - adam - 02-09-2010 01:48 AM

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!


RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts) - aseques - 02-09-2010 02:38 AM

(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 ...


RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts) - rethus - 02-21-2010 09:05 PM

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.


RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts) - aseques - 02-22-2010 05:07 AM

(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)


RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts) - rethus - 02-23-2010 10:07 PM

(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 ?


RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts) - aseques - 02-24-2010 12:41 AM

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.


RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts) - rethus - 03-17-2010 08:11 AM

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/wp-codebox/wp-codebox.php?p=68&download=getopts.php

Would be great if yout could put it into your script-package.


RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts) - rethus - 03-17-2010 09:40 AM

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?