[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) |
[HOWTO] Using the CLI to manage ispcp via command line (scripts) - aseques - 09-13-2008 02:34 AM I wanted to create create a set of tools to be able to create/modify/delete domains from the command line. This approach will be most practical when doing migrations from other control panels for example, with the list of domains+passwords, you'd be able to replicate the system in a few minutes. There is some documentation about usage at the dokuwiki here. For any suggestions, modifications of the code,etc .. post it here or edit the wiki, so it can be useful for us all Contributing code If you want to test and improve the most current code, you can connect to: http://bitbucket.org/aseques/ispcp-cli/src UPDATE Fixed the creation of TXT dns entries See CHANGELOG to view the full list of changes It's designed to work at least with the current 1.0.7 (there are older working versions too) You can call it something like: php domain.php --action create_domain --created_by "reseller" --domain "example.com" --password "password25" --hosting_plan "FullPlan" To create the hosting for the domain example.com using the template FullPlan and with the admin password password25, note that when creating a domain, the name of the admin and the domain will be the same (due to the script limitations) or php domain.php --action create_ftp --created_by "reseller" --domain "example.com" --password "password25" --hosting_plan "FullPlan" --user "username" To create the ftp account username@example.com for the previous domain. To check the usual syntax of many of the commands, you can user the verify_cli.sh that will create a sample domain with most of the features.. It has been extensively tested, and it shouldn't break anything. For anyone interested in using the script, I'm not a programmer so the code probably will hurt your eyes, any advice will be taken into consideration. I hope it will be of use to you. UPDATE: New features are included in every new release of this scripts, acording with the new features in ispcp, but the syntax and the core functionality is basically the same. There is the version working in ispcp 1.0.3.1 [attachment=1260] There is the version working for ispcp 1.0.4 [attachment=1271] The version for ispcp 1.0.5 and 1.0.6 [attachment=1470] The version for 1.0.7 and current trunk[attachment=1623] NOTE: For the version working on 1.0.0 systems send me a PM, it's obsoleted and might confuse people. RE: Using the CLI with ispcp (wiki article) - suw - 09-15-2008 07:41 AM nice to see this already done. I was a little bit bussy in the last week, had no time to edit that wiki page myself. Thank you RE: Using the CLI with ispcp (wiki article) - four2theizz0 - 10-03-2008 11:55 AM Hi, This sounds great, but I think I am missing something. I am able to telnet in and connect. But I am not sure what queries to run. Where can I see these? Thank you RE: Using the CLI with ispcp (wiki article) - aseques - 10-03-2008 05:34 PM (10-03-2008 11:55 AM)four2theizz0 Wrote: Hi, This article in the wiki is just a stub, I wanted to start the documentation, but I still haven't used this feature (I'm sure I'll need it in the future tough). Basically you should do some insert queries on one of this tables filling the same fields they're using now. The interesting tables are this ones: domain, subdomain, , domain_aliasses, mail_users If you succeed, please post your results or update the docs .. Cheers RE: Using the CLI with ispcp (wiki article) - suw - 10-07-2008 01:12 AM I feel like I have to explain why is this usefull or for who this "direct communication wiht ispcp daemon" can be usefull. Suppose you have a customer who devel. programs and want that on each registered program to give an e-mail address to customer, the program has pop/imap connection and can send mails and so on everybody's happy. Now. how in the name of sacre cow would you do this? 1. the registration server is somewhere in russia, has an IP you-re and your server are located in germany - for example. 2. the registration server can't connect to mysql ,but it's ip is allowed to access a folder restricted with .htaccess. how can you do this/ Each registered customer is made manually - If you wish to be called on 1am coz some lammer just bought the program and registered and now he wants to comunicate with others.... it's a solution. But since most of us are programmers or have some minimal skills to write a php script and a .htaccess file, the second solution is to make a script separately from ispcp who can add in ispcp's database -> email table a new email account with status - toadd and after adding this to tell ispcp's daemon to do it's magic. When I first put myself in this position - i tought that we will use C to communicate with the ispcp daemon and tell to do it's magic, but needed also the exact method how to communicate with it. After I've read the php function i've realized that, that file can be copied on any projects and use direct communication with ispcp's daemon. I hope you understand why we did this. Future NEW developers will not loose time that we lost, because our time once lost we considered that we gain some experience and it will be nice to share with others. cheers and have fun with ispcp. RE: Using the CLI with ispcp - aseques - 05-08-2009 11:26 PM I am bringing to lilve this topic again, as I am trying to make something useful of this. I started to look into the databases for the changes that would be necessary to make a domain creation. Basically I would like to do something like: add_domain.php --domain example.com --password password --hosting_plan basic So I can create a domain from the command line (i.e. from my own administration scripts) Anyone know what's the minimum information I'd need to launch the new domain process? Thanks RE: Using the CLI with ispcp (wiki article) - pgentoo - 05-09-2009 10:57 AM I would just see what the minimum fields you can give during domain creation in the UI are, and then take those in via the script. For sure, domain, email, password. I believe all that needs to be done is to insert the record into the admin and domain tables, and then call the request manager script. Not 100% on that though, but it should be a good start. Some problems though... I believe the welcome email is done through the GUI, where this should be moved into the engine at some point (for reasons like this). So if you want to send the welcome email, you'll have to do that on your own... Hope this helps... - pgentoo RE: Using the CLI with ispcp (wiki article) - sci2tech - 05-09-2009 05:49 PM Maybe this will help Needed query. PHP Code: $query = " PHP Code: $query = " PHP Code: check_for_lock_file(); RE: Using the CLI with ispcp (wiki article) - aseques - 05-09-2009 09:41 PM Thanks a lot. On monday I'll try to put it all together. At the moment I was trying to adapt the user_add3.php, so I hadn't to deal on how to apply the hosting template. Now I have much more information, I'll let you know if I suceed. Cheers. RE: Using the CLI with ispcp (wiki article) - aseques - 05-16-2009 12:50 AM Well well, I'm getting there, currently I have a script for the new domains, it checks that the required values are entered and also allow nice option passing on command line. When I'm done with the template selection I'll post the result somewhere. This would be what I'm currently doing: php new_domain.php --admin_name "example.com" --admin_pass "sample_123" Oh, the other thing I'd need is to know what algorithm are you using for the password generation, is that reversible blowfish? |