remote disable apache server and mysql database
I have a potential client who would like to use my web app but will only do so if they can have it on a server in their own office instead of using it on my hosted server. I am tempted t开发者_如何学运维o just say no, but at the same time I could use the extra client and wanted to investigate options of being able to disable the service in the event of non-payment.
I was thinking along the lines of having a cron script check a specific location on my server each day and based on the response either keep operating or disable the apache/mysql services. I could do this except one aspect eludes me. In the old days I used to be able to write a small c app using setuid(0) to execute commands as root. This seems to be no longer the case due to security which is fair enough, but I will need something like this to be able to shutdown apache and mysql.
Is there another option?
I have just also thought as I was typing that my cron script (if told to disable) could write a .htaccess file redirecting everything to a disabled message.
Has anyone done this before and if so how did you do it?
The server will be running Ubuntu.
Don't try to solve communication problems technically, because you will fail.
Instead, only hand over the work if payment has been done. Create a contract that handles the details, incl. usage rights (how many copies etc.).
Job done. Extra client for you. No hassle. No complex script that might even break your site.
I once heard of a gentleman who had a "nuke script" which he kept embedded in case of non-payment. When final debts were settled, he would enter a password and it would erase itself and it would act as if it were never there. If debts were not settled, it would back-up the clients data to his machine, and then wipe everything. Most clients never knew, those who did paid.
Here's a better solution (and one which does not involve a cron job or a back-door with a secret key): tell them that the finished product can be on their server, but you will host it until it is ready to go live. Then, when it is time, transfer all necessary data to the production server. Only promise support if they continue paying. If they don't continue paying, then that is no sweat off of your back.
精彩评论