I have installed FTP using virtual mysql users and have created a script to add or modify FTP users.
I am going to install the mail system also using virtual mysql users so here too no problem.
I know how to manually set up everything I need and have made a shell script that completely automatizes the creation of a virtualhost in apache and am now wondering how to go about doing this with a php front end script?
Which is the safest and best way to proceed?
Should I simply create a mysql database with all the domains that need creating and then create a shell script that connects to the mysql database, collects the list of domains that need setting up and installs them?
If so should I launch this script with a cronjob ? And how often do you recommend launching this script (every 5 minutes, 10 minutes, 30min, 1hour etc ...) as to not slow down the server?
Is there another way to do this? So that the accounts are created automatically?
Is there a way to tell the server to only use unused resources to perform this task?
I would be very great full if someone could give me a little push in the right direction in coding a simple CP adapted to my needs...
Using the backend database to hold the information is a good idea. I do something similar for billing my clients and setting up new hosting accounts.
I have a few cron jobs that keep the system going.
One for setting up new hosting accounts (runs every 5 minutes)
One for suspending past due clients (runs once a day)
One for sending the renewal notices (runs once a day)
and a few other crons. About 12 crons all together. It does not effect the load at all. Add as many crons you want and make them run as often as you want.
You can use the PHP frontend to insert the new hosting accounts into the database (online order form?), then use the cron job to call a shell script (or a PHP script) to search the MySQL database for new hosting accounts that need to be setup.
SELECT * FROM database WHERE new = 'true';
I would also recommend encrypting some of the data that gets put into the database like the username and password. In PHP I use the 'mcrypt' functions which work really well.
"Creating your own CP" isn't something you can simply take instructions for and say voilla, I'm done. No, you need to have intimate experience with the OS that you're dealing with.
Since the Control Panel is the key to the entire system, you need to know how to modify your MX records, your DNS records, your apache records, your SQL databases, your system users, your email records, everything.
It's not like you can wake up some day and say "voilla I can do this". A control panel takes years of planning, proper programming, development, design, testing, everything. If you're not going to release it, it will STILL take years to do this.
Steps to create a CP:
A> Take programming lessons. I'm not talking a "howto for dummies", you need in depth lessons on what you're doing.
B> Become involved with your OS on a deep, intimate level. KNOW what it does, and how to respond to it properly. This alone will take 5-10 years, not 1-2. Rushing this will mean you screw everything up.
C> Spend YEARS testing/beta testing your control panel.
Start small. If you have to ask how to go about learning to do your CP, then you're not ready. Develop something unique, like a helpdesk , a CMS first. Once you're done with the small stuff, put it all together.
WHMCS Guru - WHMCS addons, management, support and more. WHMCS Notifications Extended - Add slack, hipchat, SMS, pushover to WHMCS !!
Linux Problems? WHMCS Issues? +1-866-546-8914 (linux-14) or @whmcsguru on twitter!
thankyou kingshosting, your answer is very helpfull !
linux tech, I agree with you, you can not even think about creating your own CP without first knowing how to setup everything manually on the server. I have already done the help desk using PHP OOP + Mysql.
I haven't actually had any programming lessons but I have go a few big refferences books as well as the friend who is studing programming and who guides me and says no you shouldn't do this like this it's bes to do it like this etc ... so don't worry I'm not trying to make a CP blindfolded with no experience. I just wanted to know your point of view of the best way to go about doing this, if cronjobs was the best way or not. If there was a better way I had not thought of...
So far I guess I will use a mysql database, crypt as much as possible, and use crons to set up everything that needs root access.