Crontab Web Server Housekeeping Primer Tutorial

Crontab Web Server Housekeeping Primer Tutorial

Crontab Web Server Housekeeping Primer Tutorial

We really love to use batch processes and Linux or Unix crontab methods to do things. Guess maybe a lot of people of a certain age … cough, cough … feel quite comfortable around the bigger computer items like web servers, with their background processing potential, and can relate to processes working behind the scenes. Of course this “behind the scenes” stuff is going on even more for modern personalized computer devices, and the world has never been more connected, and “feed”y … and all feeds back somewhere are probably using a backgrounding process on some server, somewhere.

We can also purloin Linux or Unix crontab into doing quite glamorous things that affect front-end web and mobile and desktop application looks, and, of course we can harness it into doing the less glamorous (but no less important) tasks that web servers need to do too, for instance …

  • not have runaway processes eating up CPU
  • not eat up too much disk space
  • in the case of Linux and Unix, not overspill any inode (number of files) quotas for the disks

Respectively we find this most relates to …

  • MySql long running SQL
  • logs
  • PHP web application “file leaves”

And so we have our crontab at the rjmprogramming.com.au website doing a lot of tasks that (as also used in today’s tutorial picture (featuring the use of a Gimp Gaussian Blur filter)) …

These are all the “housekeeping”
tasks involving periodic clearing
of files to ensure our inode limits
are not exceeded … monitored by …

df -i /

… nor our disk space is exceeded …
… monitored by …

df -k /

They all take the form …

minute hour dayMonth month dayWeek command
specified specified * * * ksh -c “rm -f [fileSpecificationWithWildcards]”

… of cleaning up certain files once a day (for each category of file specification)

… “housekeep” the web server on behalf of its root disk called “/” (how imaginative Linux/Unix is?!). But seriously, it also has a uuid nickname that is very long and non-memorable. At least in Windows you have a label command that can give a “nickname” to your hardworking (web) server hard disk.

If this was interesting you may be interested in this too.

This entry was posted in eLearning, Operating System, Tutorials and tagged , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *