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


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

Posts: 330
Joined: May 2008
Reputation: 4
Post: #51
RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts)
Yet another update to the scripts:
.- reworked create_ftp so it doesn't depends on ftp_add.php
.- it should be compatible with newer versions than 1.0.5
And as always the code can be found on the first page of this thread and also at bitbucket.org:
http://bitbucket.org/aseques/ispcp-cli/src
08-12-2010 09:13 PM
Find all posts by this user
mdilullo Offline
Newbie
*

Posts: 5
Joined: Oct 2010
Reputation: 0
Post: #52
RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts)
Hi I want to know if the latest version of CLI works with ispCP 1.0.6 OMEGA becouse when I try to create a email acount give me this error.

php domain.php --action create_mail --domain xxxx.com --password xxxx --user xxxxx

Warning: require_once(/var/www/ispcp/gui/include/class.ispCP_Registry.php): failed to open stream: No such file or directory in /var/www/ispcp/gui/include/ispcp-lib.php on line 34

Fatal error: require_once(): Failed opening required '/var/www/ispcp/gui/include/class.ispCP_Registry.php' (include_path='/var/www/ispcp/gui/include/htmlpurifier:.:/usr/share/php:/usr/share/pear') in /var/www/ispcp/gui/include/ispcp-lib.php on line 34
webserver01:~/scripts#

PS: Sorry for my English
Thank you very much.
10-06-2010 12:00 PM
Find all posts by this user
aseques Offline
Member
*****
Dev Team

Posts: 330
Joined: May 2008
Reputation: 4
Post: #53
RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts)
(10-06-2010 12:00 PM)mdilullo Wrote:  Hi I want to know if the latest version of CLI works with ispCP 1.0.6 OMEGA becouse when I try to create a email acount give me this error.

php domain.php --action create_mail --domain xxxx.com --password xxxx --user xxxxx

Warning: require_once(/var/www/ispcp/gui/include/class.ispCP_Registry.php): failed to open stream: No such file or directory in /var/www/ispcp/gui/include/ispcp-lib.php on line 34

Fatal error: require_once(): Failed opening required '/var/www/ispcp/gui/include/class.ispCP_Registry.php' (include_path='/var/www/ispcp/gui/include/htmlpurifier:.:/usr/share/php:/usr/share/pear') in /var/www/ispcp/gui/include/ispcp-lib.php on line 34
webserver01:~/scripts#

PS: Sorry for my English
Thank you very much.
Hi, I made a mistake when I uploaded the scripts the last time. I uploaded the version for the newer version (current trunk) that relies on some classes not yet available in 1.0.6.
Now you can find two versions of the scripts:
.- The 1.0.5.tar.gz (for 1.0.5 and 1.0.6)
.- The 1.0.7.tar.gz for 1.0.7 and current trunk.

Tell me if the 1.0.5 still has problems working under 1.0.6
10-06-2010 06:11 PM
Find all posts by this user
mdilullo Offline
Newbie
*

Posts: 5
Joined: Oct 2010
Reputation: 0
Post: #54
RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts)
I download the package scripts_1_0_5.tar.gz but when I ran the first time gave me the following error:

php domain.php --action create_mail --domain xxx.com --password xxx --user xxx
Warning: require_once(ftp_add.php): failed to open stream: No such file or directory in /root/scripts/domain.php on line 22
Fatal error: require_once(): Failed opening required 'ftp_add.php' (include_path='/var/www/ispcp/gui/include/htmlpurifier:.:/usr/share/php:/usr/share/pear') in /root/scripts/domain.php on line 22

Then download the package scripts_1_0_4.tar.gz and only extract the file ftp_add.php.
Rann the script again and this time It's ran perfect.

Thanks for the help.
PS: Sorry for my English
(This post was last modified: 10-07-2010 12:16 PM by mdilullo.)
10-07-2010 12:15 PM
Find all posts by this user
mdilullo Offline
Newbie
*

Posts: 5
Joined: Oct 2010
Reputation: 0
Post: #55
RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts)
Hi thanks for the help last time.
Now I have another query.
When I create a mail alias the script says that the domain does not exist.
Looking at the code I found this online.
$result = $mysqli->query("SELECT `domain_id` FROM `domain` WHERE `domain_name`='$domain'");
But the problem is that the domain is an alias and the query no search for it.
Then change the line for this.
$result = $mysqli->query("SELECT `alias_id` FROM `domain_aliasses` WHERE `alias_name`='$domain'");
But It didn't work too.
There any way to do what I need.

php domain.php --action create_mail_alias --domain DOMAIN-ALIAS --mail_dst webmaster@DOMAIN --user temp

Thanks for the help.
11-14-2010 04:31 PM
Find all posts by this user
aseques Offline
Member
*****
Dev Team

Posts: 330
Joined: May 2008
Reputation: 4
Post: #56
RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts)
(11-14-2010 04:31 PM)mdilullo Wrote:  Hi thanks for the help last time.
Now I have another query.
When I create a mail alias the script says that the domain does not exist.
Looking at the code I found this online.
$result = $mysqli->query("SELECT `domain_id` FROM `domain` WHERE `domain_name`='$domain'");
But the problem is that the domain is an alias and the query no search for it.
Then change the line for this.
$result = $mysqli->query("SELECT `alias_id` FROM `domain_aliasses` WHERE `alias_name`='$domain'");
But It didn't work too.
There any way to do what I need.

php domain.php --action create_mail_alias --domain DOMAIN-ALIAS --mail_dst webmaster@DOMAIN --user temp

Thanks for the help.
That's a problem. I'm using ispcp in a particular way, when I create a domain alias, all the addresses are automatically pointing to their equivalents and I haven't implemented the mail alias option as you need.

More info here:
http://isp-control.net/documentation/how...base_quota


If you want to provide a patch to accomplish what you need, of course I'll accept it ...
11-15-2010 07:42 PM
Find all posts by this user
mdilullo Offline
Newbie
*

Posts: 5
Joined: Oct 2010
Reputation: 0
Post: #57
RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts)
I'm change the switch case create_mail_alias for this code:
PHP Code:
case "create_mail_alias":
                
//Requires $domain, $user, $mail_dst,
                
echo "Creating the mailbox alias $user@$domain pointing to $mail_dst\n";

                
//Alias verification
              
$result $mysqli->query("SELECT `alias_id` FROM `domain_aliasses` WHERE `alias_name`='$domain'");
            if (
$result->num_rows>0) {
                        
$row=$result->fetch_row();
                        
$alias_id=$row[0];
                        
$result->close();
         } else {
                echo 
"ERROR: You are trying to use a non-existant Alias domain\n";
                exit(
0);
      }
      
      
//Domain verification
            
$result $mysqli->query("SELECT `domain_id` FROM `domain_aliasses` WHERE `alias_name`='$domain'");
            if (
$result->num_rows>0) {
                        
$row=$result->fetch_row();
                        
$domain_id=$row[0];
                        
$result->close();
         } else {
                echo 
"ERROR: You are trying to use a non-existant domain\n";
                exit(
0);
      }

                
//Email verification
      
$result $mysqli->query("SELECT `mail_addr` FROM `mail_users` WHERE `mail_addr`='$user@$domain'");
                if (
$result->num_rows !=0) {
                        echo 
"ERROR: You are trying to create an existant mail address\n";
                        exit(
0);
                }

                
//TODO, allow the quota to be set with a parameter
                //Adding the alias
                
$sql "INSERT INTO `mail_users` VALUES  ('','" $user "','_no_" .
                        
"','" $mail_dst "','" $domain_id "','alias_forward','" $alias_id "','toadd',0,'NULL',10485760,' " .
                        
$user "@" $domain "')";
                
//echo $sql . "\n";

                //Adding the user
                
if (!$mysqli->query($sql)) {
                        
printf("ERROR: %s\n"$mysqli->error);
                        exit(
0);
                }

        break; 

This is not very pretty but it works.
The only thing that you have to do is replace the complete switch case create_mail_alias. Them you can use the function whith the same function name and the same parameters.
WARNING previous functionality is lost.
Now I am working to create a new switch case to add to domain.php but I wanted to upload this in case someone needed it.
Greetings and thanks for the help.
Sorry for my English.
(This post was last modified: 11-18-2010 03:12 PM by mdilullo.)
11-18-2010 03:11 PM
Find all posts by this user
flotix Offline
Junior Member
*

Posts: 28
Joined: Jan 2009
Reputation: 0
Post: #58
RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts)
He is working with 1.0.7?

because when i add a domain, he is an error domain...
and when i want to delete them, ispcp say "bad ID".

And when i add a domain dns, i have this error :

Quote:Notice: Constant INCLUDEPATH already defined in /var/www/ispcp/gui/include/ispcp-lib.php on line 47

Fatal error: Call to a member function attach() on a non-object in /var/www/ispcp/gui/include/ispcp-lib.php on line 80
01-19-2011 12:04 AM
Find all posts by this user
flotix Offline
Junior Member
*

Posts: 28
Joined: Jan 2009
Reputation: 0
Post: #59
RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts)
it works when i remove include ftp_add.php
01-20-2011 07:32 PM
Find all posts by this user
rethus Offline
Junior Member
*

Posts: 202
Joined: May 2009
Reputation: 3
Post: #60
RE: [HOWTO] Using the CLI to manage ispcp via command line (scripts)
aseques:
After Long time, i ffound my Script, which i create to completly move Plesk-Data to ispCP. You helped me a lot with your CLI-Script.
Here is a Project on Sourceforge. This may interesting for you.

https://sourceforge.net/projects/plesk2ispcp/

I'm sure, you have optimize your script since i last use it, and created my Plesk2ispCP. If you wan't to come a member of the Project, i would be glad.

The Script has ccost me many many hours, but works realy good for me at the end. Hope it helps People who want to change from plesk to ispcp.
02-25-2011 11:39 PM
Find all posts by this user
Thread Closed 


Forum Jump:


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