Is there a way one could automate daily maintenance task on the website?

The maintenance task could include a number of things:
cleaning up database,
updating the website and so on...

Recommended Answers

All 4 Replies

In terms of basic tools, ISP's usually have CRON where you can schedule jobs. There is also a scheduler that you can implement yourself (phpjobscheduler) at
http://www.phpjobscheduler.co.uk/

They also have a database backup utility at:
http://www.dwalker.co.uk/phpmysqlautobackup/

For other automation tasks that can be scheduled using one of these tools, you will have to search for a utility that does what you need or build your own. I was just working on that very topic myself today. I built my own tools to screen-scrape info from another site (and update a db) and to send out reminders by email. These were very specific to my needs so they had to be custom designed and built. If you have a utility that you run manually now (that can work from parms - not from form input) then it's pretty easy to set it up to run automatically. If you don't have the utility, then you may need to do some development.

Chris

In terms of basic tools, ISP's usually have CRON where you can schedule jobs. There is also a scheduler that you can implement yourself (phpjobscheduler) at
http://www.phpjobscheduler.co.uk/

They also have a database backup utility at:
http://www.dwalker.co.uk/phpmysqlautobackup/

For other automation tasks that can be scheduled using one of these tools, you will have to search for a utility that does what you need or build your own. I was just working on that very topic myself today. I built my own tools to screen-scrape info from another site (and update a db) and to send out reminders by email. These were very specific to my needs so they had to be custom designed and built. If you have a utility that you run manually now (that can work from parms - not from form input) then it's pretty easy to set it up to run automatically. If you don't have the utility, then you may need to do some development.

Chris

I am all willing to do the development.

But how would you automate something as simple as writing a word to the site everyday, for the sake of example.. or changing the header? I am missing the automation part... how do you automate/schedule something in PHP?

phpjobscheduler may do the task for me, but I will have to review the terms and conditions more carefully... like if they want me to advertise their site or something like that... hmmm

anyway, let me know if you have any pointers on coding a scheduler myself... if it's too much of a daunting task, then let me know that as well :D

Hey, you would to use crontab to do this job depending on what type of server you are running this on you should have no problem. Crontab is almost on all linux machines. If you have a shared host server you may have to ask them how to run a cron job. Once you have set that up. In crontab you can use wget to run your php scripts.


So, for example,


If you type crontab -e into ssh it will bring up the crontab file to edit or to add a new job. So here is an example cronjob

10 3 * *  wget runbackup.php

This crontab job will run your php script at 3:10 am everyday.

Hope this helps.

You don't need to create your own scheduler as the ones that are available for free are quite adequate.

In terms of how to create an automation program, the same program can be run manually so forget about automation per se and just think in terms of a program that can run without screen input. It needs to work with info that it can get from a website, from parameters, a database or a file. If you want to change content on your web site, then the way in which the site is designed will make a big difference. If you have html or php with embedded text (assuming that the text is what you will want to change), then you will probably want to change the code to read in the text from a file or a database. The automation program would change the text in the file or database. If you wanted to change your background color/image on your site based on the day of the week (as a simple example), then the background color/image url would have to be a parameter in a file or the database that the automation program could change. I don't think that you would want to get into parsing html or php code to change text or parameters. That could be done for a simple php module with parameters but there are probably better ways.

Chris

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.