Websites never sleep but you may want to, this script lets you do that without having to worry about Apache or Mysql crashing randomly.
Obviously if you have reoccurring issues its best to check through the log files and fix any issues but this will help reduce down time on vital software crashes to less than a minute by checking for Apache and Mysql services running and if none are found they get restarted.
Save this into a .sh file somewhere on your server and run this every minute usinng the built in Ubuntu Cron. If you are using a different OS and this doesn’t work replace the restart commands.
# APACHE SECTION
if [ $? -ne 0 ]
# MYSQL SECTION
if [ $? -ne 0 ]
To improve this script you could add email notifications and other vital services like sendmail which if they go down may be less apparent.
Learning new programming languages is fun but it can be difficult choosing which references and books to use. Most good text book will cost a small fortune and go out of date within a few months and probably wont cover everything you need.
For me the best resource comes straight from the source, for most languages you will be able to find a FREE and complete reference to develop with.
PHP Documentation – Download the complete reference in most spoken languages.
w3 CSS v1 – Full guide to CSS v1 from 1996 – 2009 in PDF format.
w3 guide to css 2.1 – Full on-line reference to css v2.1
w3 HTML 3 guide - An awesome guide to HTML, very handy for SEO Tricks,
Action Script 3 – Official full guide to Action script 3 programming.
CS3 – The full CS3 shabang from Adobe, I haven’t found a decent Flash book yet so this is awesome.
Mysql - One of the less helpful guides but it is fairly complete.
WordPress Functions - The official function list, awesome for any wordpress project