Walking Trip …

Walking Trip

Walking Trip

Offenbach's Suite ... Warts 'n All

Offenbach's Suite ... Warts 'n All

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

Posted in Photography, Trips | Tagged , , | 34 Comments

Troubleshooting CentOS Web Server Disk Zencart Issue Tutorial

Troubleshooting CentOS Web Server Disk Zencart Issue Tutorial

Troubleshooting CentOS Web Server Disk Zencart Issue Tutorial

Out of the previous CentOS Exim Advanced Configuration Primer Tutorial‘s analysis phases …

  • hard disk space
  • hard disk inode count (for Linux and unix web servers)

… that latter one raised its-not-so-good-looking head for two days last Sunday (in the middle of the Sydney, Australia day) and Monday (up until resolving around 11am Sydney time). Not that I immediately knew that. Our symptoms of “something wrong” consisted of …

  • all parts of Apache web server (for RJM Programming) websites working, including MySql ones
  • cPanel hung
  • FileZilla sftp got connection resets

… which is tempting to ignore, and hide the old noggin in the stuff that falls through the hourglass.

Luckily, though, my torpor was disturbed by needing to sftp an image over to the web server to complete yesterday’s tutorial.

Now, it’s inconvenient that the title gives “the general game away” about the source of the issue, but it would be an imaginative operator indeed who could jump to this “even general conclusion” from these symptoms, without getting access to this web server. And on reflection, had we used Power Management to see whether that would have had a chance of fixing the issue, it would have been a waste of time.

So what did we do first on Sunday? Well, we could still log in via ssh and on the RJM Programming web server, went …


# service sshd restart
Stopping sshd: [ OK ]
touch: cannot touch `/var/lock/subsys/sshd': No space left on device

  • df -k /
  • df -i /

… as per …


# df-k /
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda3 133526580 112886392 13860736 90% /
root@vs-rmetcalfe [~]# df -k /tmp
Filesystem 1K-blocks Used Available Use% Mounted on
/usr/tmpDSK 544256 328968 187640 64% /tmp
root@vs-rmetcalfe [~]# df -k /var
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda3 133526580 112886456 13860672 90% /
root@vs-rmetcalfe [~]# df -i /
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda3 8478720 8478720 0 100% /

… to arrive at “there is an inodes quota running out issue with the RJM Programming web server hard disk”.

So what did we do later on Sunday? We still could, believe it or not, from an already open FileZilla session, delete a goodly number of web server files, which we (recursively) did to get some thousands of inodes to become available again. That left the RJM Programming web server fully functional as we went to “shut eye places”. We gave the web server one task (via our Linux Disk Usage cPanel Heads Up Tutorial) to do for these sleeping hours

# du -a / 2> /dev/null | sort -n -r | head -15

… but it petered out, alas. It is a very intensive “ask”, after all. So this takes us to Monday, where we woke up to …

  • hard disk space
  • hard disk inode count (for Linux and unix web servers)

… back to the original issue, again.

So what did we do on Monday? Well, amongst the research we lobbed onto this useful link, thanks, that got us to go …

find / -ctime -1 -print

… to get a list of files created over the last day. And that was the breakthrough, really, for us, as it lead us to seeing in that list thousands of entries for the filespec …


/home/virtfs/rjmprogr/home/rjmprogr/public_html/zencart/cache/myDEBUG-*.log

… and we noticed when going through a few cycles of …


# ls -clt /home/virtfs/rjmprogr/home/rjmprogr/public_html/zencart/cache/myDEBUG-*.log
# ls -clt /home/virtfs/rjmprogr/home/rjmprogr/public_html/zencart/cache/myDEBUG-*.log
# ls -clt /home/virtfs/rjmprogr/home/rjmprogr/public_html/zencart/cache/myDEBUG-*.log

… each list would get considerably longer over the length of time it took to list the previous! Runaway train had us gobsmacked! Eventually, though we tweaked to “the short term solution” …


# ksh -c 'for i in `find /home/virtfs/rjmprogr/home/rjmprogr/public_html/zencart/cache/ -name "myDEBUG-*.log"`; do rm -f $i; done'
# df -i /
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda3 8478720 8428558 50162 100% /
# df -i /
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda3 8478720 8429300 49420 100% /

… yayyyyy!!! (with a caveat of “just relief for now but must find the ultimate reason”) … but there were some back again on the next … a growing list again … plus the RJM Programming ZenCart eCommerce website came up with error message “WARNING: An Error occurred, please refresh the page and try again.” … mesmerized, we repeated the listings, watching the list grow, until it occurred to us, encouraged by that previous link talking about the error could be related to the MySql ZenCart database, to …


# cat /home/virtfs/rjmprogr/home/rjmprogr/public_html/zencart/cache/myDEBUG-1575848271-674789.log
[09-Dec-2019 07:37:51 Australia/Perth] PHP Fatal error: 145:Table './rjmprogr_zencart/sessions' is marked as crashed and should be repaired :: select value
from sessions
where sesskey = '42f9199e81e8c1eeb411921161c67ab9'
and expiry > '1575848271' in /home/rjmprogr/public_html/zencart/includes/classes/db/mysql/query_factory.php on line 101

… giving us the long term remedy …

  1. get into cPanel
  2. search for phpMyAdmin option, and click it
  3. access the rjmprogr_zencart database (and see that sessions table is indeed marked as crashed)
  4. within SQL tab textarea type …

    REPAIR TABLE sessions

    … click the GO button … successful

… sanity checked in that “the list” no longer grows!!! And as for the inodes quota issue …


# df -i /
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda3 8478720 8425232 53488 100% /

… a lot better, especially as this time it only appears to be getting better (ie. IFree stays roughly the same or gets bigger (with our other crontab remedies we have implemented)). And ZenCart works again. What a relief!


Previous relevant CentOS Exim Advanced Configuration Primer Tutorial is shown below.

CentOS Exim Advanced Configuration Primer Tutorial

CentOS Exim Advanced Configuration Primer Tutorial

There are two file resource aspects to watch out for regarding a web server hard disk storage …

  • hard disk space
  • hard disk inode count (for Linux and unix web servers)

… which can, respectively, be monitored by Linux commands …

  • df -k /
  • df -i /

On our CentOS rjmprogramming.com.au web server recently we had occasion to do a check of this, and wanted to improve the web server hard disk situation for both measures, picking the /var folder of our web server. So we executed, respectively …

  • find /var -xdev -type f -size +100M
  • find /var -mtime -1 -ls

… the latter one being a list of files on /var modified in the last day being our idea to try to see what daily log filing might be contributing big time to hard disk inode usage. And that’s where we found out this way that our Exim Mail Server logs extensively, and that we could do without those in folders off …


/var/spool/exim/msglog/

We tried the latter of two deletion ideas we show below …

  • all at once via …

    cd /var/spool/exim
    find msglog -type f -exec rm -rf {} \;
  • broken up … via a series of deletions of the ilk …

    cd /var/spool/exim/msglog
    rm -f A/*
    rm -f a/*

Then the next job was to stop Exim remaking these logs and wish to thank this useful link for great advice here, that led to this advice we give …

  1. log in to WHM cPanel
  2. in search bar type “Exim”
  3. click the “Exim Configuration Manager”
  4. click “Advanced Editor” tab (up the top)
  5. click the blue “Add additional configuration setting” button well down the webpage
  6. click “message_logs” in left hand drop down
  7. set value of this setting to “false”
  8. click blue “Save” button down the bottom of webpage to complete the steps here

You may find this is a web server configuration of interest to you too.

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


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

Posted in eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , , , , , | Leave a comment

HTML Multiple Form Multiple Submit or Image Buttons Tutorial

HTML Multiple Form Multiple Submit or Image Buttons Primer Tutorial

HTML Multiple Form Multiple Submit or Image Buttons Tutorial

The previous HTML Multiple Form Multiple Submit Buttons Primer Tutorial‘s web application used as its HTML form navigation conduit …

  • the clicking of input type=submit buttons … but did you know that there is an alternative HTML form navigation button methodology …
  • the clicking of input type=image buttons … with two major differences, those being …
    1. src property can point to an underlying image URL to show as the button background (and foreground)
    2. as we say in today’s tutorial picture
      Difference with input type=image
      to type=submit is that click position
      relative to element top left is
      additionally passed

… which we code for today with the changed multiple_form_multiple_submit_buttons.html for your perusal. The use of that type=image input form navigation adds more possibilities to trace back to what happens in a (window.parent) parent window. Interesting, huh?


Previous relevant HTML Multiple Form Multiple Submit Buttons Primer Tutorial is shown below.

HTML Multiple Form Multiple Submit Buttons Primer Tutorial

HTML Multiple Form Multiple Submit Buttons Primer Tutorial

Anality is a funny thing. Tend to want to follow through in an anal way to show you our multiple form with multiple submit buttons tutorial even though it would be obvious to most recent readers of our blog, that there would be no issues with this very small extension of function creep over the tutorials headed by HTML Multiple Form Submit Buttons Primer Tutorial as shown below. Nevertheless, HTML work can often surprise with unusual cross-browser issues, and you can really get stung when you have no anal molecules in your programming brain. Personally, though, think anality often doesn’t come into play much in life with matters that are of little personal interest.

Today we want to discuss a very old HTML concept called the form tag which allows for the processing of interactive input from the user in the form of textboxes and checkboxes and radio buttons and buttons to transfer information from one webpage to another, somewhere.

For clarity, today, we only use buttons spread over multiple forms, and you may ask, “What good are buttons on their own for imparting information?” … and will ignore the obvious answer that a button press anywhere, depending on the event logic, can mean so much … after all, we all envisaged the disaster of a nuclear holocaust envisaging the press of one button … no, we want to talk about the idea that you can have more than one form tag with one input type=’submit’ button each … and this was not always the case, because in the early days of HTML there was the one submit button allowed on one HTML form … as you see today, now, you can have more than one form, which has more than one submit nutton, per webpage.

Anyway, you might still ask, anyway, “Ignoring the huge event logic possibilities of a button press (because you are not trying to trick me here), what good are buttons on their own for imparting information?” … well, it means on the callback … and today we just callback the same HTML code (via the form‘s action= designation of itself, today) … as we often like to do at this blog, by the way … we can compartmentalize via the GET (in our form’s method case … for starters, with POST we’d need Ajax or a server language, and remember we are trying to keep things more basic here) parameters in the callback URL (stored in “Javascript DOM land” as document.URL) according to the value of that submit button whose name becomes that GET parameter’s name … so that for an HTML form‘s submit button like …


<input type='submit' title='Submit of form to an embedded iframe' onclick='cif();' name='submitiframe' id='submitiframe' value='Validate and Iframe'></input>

… its contributing part of the callback URL, in our code, is …


... ?submitiframe=Validate+and+Iframe ...

… and so we can, in Javascript, at the onload event‘s code … have an else if statement like …


} else if (document.URL.indexOf('iframe=') != -1) {
// do something here
}

… to have a good compartmentalizing of “action” segments of code that is quite readable and understandable.

If the case is not clear … please tee up a live run with the HTML programming source code multiple_form_multiple_submit_buttons.html (changed from two days ago, when we had multiple submit buttons with one form, as per multiple_form_multiple_submit_buttons.html) … or else please try some HTML code yourself … the hardest concept here today is the embedding of an iframe in a hierarchical way (note the Javascript DOM manipulation of the form‘s target= designation, as you examine the downloadable code above), and so for clarity we preface any iframe by a current client (ie. Javascript) timestamp, so you know who inherits who etcetera etcetera etcetera.

Now even after all this, you may want to say, “So what … an HTML a tag link can do all this. … to which we say … that’s true … good to know there is more than one way to “skin a cat” … meowwwwwwww! … “no animals were harmed in the making of this tutorial”.

In fact you could go on and on and on with possibilities for the equivalent means by which to achieve the ends we have here with our HTML, such as using an input type=”button” or in HTML5, a button tag, and all these and more and more and more and more are worth exploring, and trying, yourself, or by researching the subject. One day, in a real bind, with cross-browser issues, you may need that extra method, to make things work for all the platforms?!

Think that HTML forms can be a very useful business logic tool, and we haven’t even delved into the non-button GUI elements yet.


Previous relevant HTML Multiple Form Submit Buttons Primer Tutorial is shown below.

HTML Multiple Form Submit Buttons Primer Tutorial

HTML Multiple Form Submit Buttons Primer Tutorial

Today, following up on yesterday’s PHP Rhopalic Letter Sentence Game Primer Tutorial and the day before’s HTML Form Multiple Submit Buttons Primer Tutorial as shown below, we want to discuss a very old HTML concept called the form tag which allows for the processing of interactive input from the user in the form of textboxes and checkboxes and radio buttons and buttons to transfer information from one webpage to another, somewhere.

For clarity, today, we only use buttons spread over several forms, and you may ask, “What good are buttons on their own for imparting information?” … and will ignore the obvious answer that a button press anywhere, depending on the event logic, can mean so much … after all, we all envisaged the disaster of a nuclear holocaust envisaging the press of one button … no, we want to talk about the idea that you can have more than one form tag with one input type=’submit’ button each … and this was not always the case, because in the early days of HTML there was the one submit button allowed on one HTML form … as you see today, now, you can have more than one form per webpage.

Anyway, you might still ask, anyway, “Ignoring the huge event logic possibilities of a button press (because you are not trying to trick me here), what good are buttons on their own for imparting information?” … well, it means on the callback … and today we just callback the same HTML code (via the form‘s action= designation of itself, today) … as we often like to do at this blog, by the way … we can compartmentalize via the GET (in our form’s method case … for starters, with POST we’d need Ajax or a server language, and remember we are trying to keep things more basic here) parameters in the callback URL (stored in “Javascript DOM land” as document.URL) according to the value of that submit button whose name becomes that GET parameter’s name … so that for an HTML form‘s submit button like …


<input type='submit' title='Submit of form to an embedded iframe' onclick='cif();' name='submitiframe' id='submitiframe' value='Validate and Iframe'></input>

… its contributing part of the callback URL, in our code, is …


... ?submitiframe=Validate+and+Iframe ...

… and so we can, in Javascript, at the onload event‘s code … have an else if statement like …


} else if (document.URL.indexOf('iframe=') != -1) {
// do something here
}

… to have a good compartmentalizing of “action” segments of code that is quite readable and understandable.

If the case is not clear … please tee up a live run with the HTML programming source code multiple_form_submit_buttons.htm (changed from two days ago, when we had multiple submit buttons with one form, as per multiple_form_submit_buttons.htm) … or else please try some HTML code yourself … the hardest concept here today is the embedding of an iframe in a hierarchical way (note the Javascript DOM manipulation of the form‘s target= designation, as you examine the downloadable code above), and so for clarity we preface any iframe by a current client (ie. Javascript) timestamp, so you know who inherits who etcetera etcetera etcetera.

Now even after all this, you may want to say, “So what … an HTML a tag link can do all this. … to which we say … that’s true … good to know there is more than one way to “skin a cat” … meowwwwwwww! … “no animals were harmed in the making of this tutorial”.

In fact you could go on and on and on with possibilities for the equivalent means by which to achieve the ends we have here with our HTML, such as using an input type=”button” or in HTML5, a button tag, and all these and more and more and more and more are worth exploring, and trying, yourself, or by researching the subject. One day, in a real bind, with cross-browser issues, you may need that extra method, to make things work for all the platforms?!

We’ve come across multiple forms being used here at this blog in the reasonably recent past in the sequence of tutorials “headed” by PHP/HTML Google Chart Wordtree Chart Local File Tutorial‘s mention of a supervisory live run (that link points here) … it, too, was all about compartmentalized pieces of functionality that each form got involved with … though some generic forms, shared their functionality for various purposes, as well.

Hope you get something out of today’s thoughts above.


Previous relevant PHP Rhopalic Letter Sentence Game Primer Tutorial is shown below.

PHP Rhopalic Letter Sentence Game Primer Tutorial

PHP Rhopalic Letter Sentence Game Primer Tutorial

Today we put the implications of HTML Form Multiple Submit Buttons Primer Tutorial as shown below, to use, for a callback scenario in two parts, the most complex part of which we want to differentiate about the instigation of sharing (or challenging) functionality to allow for the sending of an email regarding a snapshot look about the game’s state of play.

So what does “rhopalic” mean? Maybe you dream of a week consisting of “rhopalic” lunch breaks? Or year by year having “rhopalic” feeling holiday periods? Yes, a “rhopalic” sentence consists of words that keep getting longer by one letter, or one syllable … we do the one letter concept, today, with our English word game … “English” because we rely on an English dictionary lookup where we call on our web server here at www.rjmprogramming.com.au to look up its inbuilt Linux English based dictionary files … for the fastest, and homegrown, effect … perhaps you’d like to consult Linux dictionary files for more information here.

This game has an ESL feel to it, but am not sure you should expose an early English learner to its trivialisation of the language. A “rhopalic” sentence outside the hands of a great English wordsmith is a sad sight indeed …. just play the game and see the “lame” sentence presented as the default (ie. no English wordsmiths were involved), and you see what I mean … but am sure there are great wordsmiths out there? … and that they may know each other’s email addresses?! … and are up for a challenge?!?

Here is some downloadable PHP programming source code you could call rhopalic_letter_sentence.php or try a live run or simulate the return of an emailee’s interaction here.

Hope you enjoy the game and get further thought bubbles regarding HTML form multiple submit button usage possibilities.

If you are wondering where the “rhopalic” idea came from? Answering (wrongly, as it happens) a Sydney Morning Herald (the mobile app edition of the paper) quiz question a few days back.


Previous relevant HTML Form Multiple Submit Buttons Primer Tutorial is shown below.

HTML Form Multiple Submit Buttons Primer Tutorial

HTML Form Multiple Submit Buttons Primer Tutorial

Today we want to discuss a very old HTML concept called the form tag which allows for the processing of interactive input from the user in the form of textboxes and checkboxes and radio buttons and buttons to transfer information from one webpage to another, somewhere.

For clarity, today, we only use buttons, and you may ask, “What good are buttons on their own for imparting information?” … and will ignore the obvious answer that a button press anywhere, depending on the event logic, can mean so much … after all, we all envisaged the disaster of a nuclear holocaust envisaging the press of one button … no, we want to talk about the idea that you can have more than one input tag with type=’submit’ … and this was not always the case, because in the early days of HTML there was the one submit button allowed on one HTML form … now you can even have more than one form … but this is for another day.

Anyway, you might still ask, anyway, “Ignoring the huge event logic possibilities of a button press (because you are not trying to trick me here), what good are buttons on their own for imparting information?” … well, it means on the callback … and today we just callback the same HTML code (via the form‘s action= designation of itself, today) … as we often like to do at this blog, by the way … we can compartmentalize via the GET (in our form’s method case … for starters, with POST we’d need Ajax or a server language, and remember we are trying to keep things more basic here) parameters in the callback URL (stored in “Javascript DOM land” as document.URL) according to the value of that submit button whose name becomes that GET parameter’s name … so that for an HTML form‘s submit button like …


<input type='submit' title='Submit of form to an embedded iframe' onclick='cif();' name='submitiframe' id='submitiframe' value='Validate and Iframe'></input>

… its contributing part of the callback URL, in our code, is …


... ?submitiframe=Validate+and+Iframe ...

… and so we can, in Javascript, at the onload event‘s code … have an else if statement like …


} else if (document.URL.indexOf('iframe=') != -1) {
// do something here
}

… to have a good compartmentalizing of “action” segments of code that is quite readable and understandable.

If the case is not clear … please tee up a live run with the HTML programming source code multiple_form_submit_buttons.html … or else please try some HTML code yourself … the hardest concept here today is the embedding of an iframe in a hierarchical way (note the Javascript DOM manipulation of the form‘s target= designation, as you examine the downloadable code above), and so for clarity we preface any iframe by a current client (ie. Javascript) timestamp, so you know who inherits who etcetera etcetera etcetera.

Now even after all this, you may want to say, “So what … an HTML a tag link can do all this. … to which we say … that’s true … good to know there is more than one way to “skin a cat” … meowwwwwwww! … “no animals were harmed in the making of this tutorial”.

In fact you could go on and on and on with possibilities for the equivalent means by which to achieve the ends we have here with our HTML, such as using an input type=”button” or in HTML5, a button tag, and all these and more and more and more and more are worth exploring, and trying, yourself, or by researching the subject. One day, in a real bind, with cross-browser issues, you may need that extra method, to make things work for all the platforms?!

Did you know?

With an HTML input type=”submit” (submit button), there is nothing stopping you storing more than just the “front look” of the button in its value= parameter. If you want to do this, but there is no way you want to show that “data” as the “front look” of the button, perhaps it really should be an input type=”hidden” piece of data, or you should hide it … via style=”display:none;” … Javascript DOM store data to it via document.getElementById([itsID]).value=[myData]; … and, conditionally perhaps, click it via Javascript, via document.getElementById([itsID]).click(); method.

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


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


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


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


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

Posted in eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , | Leave a comment

Troubleshooting Landing Page Crontab Curl Tutorial

Troubleshooting Landing Page Crontab Curl Tutorial

Troubleshooting Landing Page Crontab Curl Tutorial

Back earlier in December (2019) the crontab/curl work of Landing Page Mobile Phone Crontab Curl Tutorial must have been disrupted.

Why think that?

The RJM Programming Landing Page dropdown of blog tutorial links was missing something … anyone, anyone? … yes, Sunil Gavaskar … its blog posting links. And how are they created each day … anyone, anyone? … yes, Laika, look down to Landing Page Mobile Phone Crontab Curl Tutorial to read all about it.

Do you think it would be good to try, via ssh access what crontab/curl automates on the RJM Programming web server, but on the command line?

Excellent suggestion!


$ curl HTTP://www.rjmprogramming.com.au/PHP/tutorial_options.php
<b>Error 3: Error writing file '/tmp/MYpxajPE' (Errcode: 28)</b><option selected='selected' value=' '>Tutorials (show blog, toggle sort order) ...</option>

Ah! Do you think a diskspace examination of the /tmp disk on this Linux web server would reveal anything useful?

You’re on a roll!


$ df -k /tmp
Filesystem 1K-blocks Used Available Use% Mounted on
/usr/tmpDSK 544256 513316 3292 100% /tmp

Wow, that’s bad! Do you think a file listing examination of the /tmp disk on this Linux web server would reveal anything useful?

Have you been reading the script to all this?


$ ls -l /tmp
total 490508
drwxrwxrwt 114 owner group 294912 Dec 2 03:54 ./
dr-xr-xr-x. 25 owner group 4096 Dec 1 04:49 ../
-rw-r--r-- 1 owner group 32 Aug 9 2014 adminer.key
-rw-r--r-- 1 owner group 27 Aug 26 2014 aexception.is
drwx------ 2 owner group 4096 Jun 16 2018 ansible_Hinjci/
-rw-r--r-- 1 owner group 225887 Dec 2 02:04 basegetmelist.is
-rw-r--r-- 1 owner group 225887 Dec 2 02:01 basegetmelist.wis
-rw-r--r-- 1 owner group 43615 Jan 18 2015 basegetmelist.wisold
-rw-r--r-- 1 owner group 17099 Apr 8 2014 BatsAndBall.tcl
-rw-r--r-- 1 owner group 130989 Apr 23 2018 CDB-simple_after_LibreOffice.htm
-rw-r--r-- 1 owner group 20624 Jun 4 2015 check-mk-agent.rpm
drwx------ 2 owner group 4096 May 11 2019 clamav-030407a30e41469e50714e18d06cfef6/
drwx------ 2 owner group 4096 Nov 10 2018 clamav-05c7969f7c92127c0a67d1e1e030ff7a/
drwx------ 2 owner group 4096 Jun 16 2018 clamav-0c9c5d08dd88487d2db8ab0d89844a98/
# more follows ...
-rw------- 1 owner group 20041728 Dec 1 02:32 magick-299501ChMis2EYamN
-rw------- 1 owner group 31457280 Dec 1 02:32 magick-29950E5FvDZxbZUTb
-rw------- 1 owner group 31457280 Dec 1 02:33 magick-30009gmKHkoN2pnsz
-rw------- 1 owner group 31457280 Dec 1 02:32 magick-30011B1tagrDAr7pR
-rw------- 1 owner group 31457280 Dec 1 02:33 magick-30011VUw-Xwaqo2lT
-rw------- 1 owner group 31457280 Dec 1 02:33 magick-30043kgDfzEiS4YhO
-rw------- 1 owner group 31457280 Dec 1 02:34 magick-30089dJLmu7BUm4Cw
-rw------- 1 owner group 31457280 Dec 1 02:33 magick-30133nUvTOGPaB5XG
-rw------- 1 owner group 31457280 Dec 1 02:33 magick-30133qaJFxqr0Kbgr
-rw------- 1 owner group 7234560 Dec 1 02:45 magick-33938vgJrHboBpWeI
-rw------- 1 owner group 31457280 Dec 1 02:59 magick-36847TC-kxmkRqR4V
-rw------- 1 owner group 31457280 Dec 1 03:00 magick-36847YUdME4k4jgwh
-rw------- 1 owner group 31457280 Dec 1 02:59 magick-368918jQfT0gouz5z
-rw------- 1 owner group 31457280 Dec 1 03:00 magick-36891NSRHciA7uHb8
-rw------- 1 owner group 31457280 Dec 1 03:00 magick-3707285W0V0oGoH97
-rw------- 1 owner group 31457280 Dec 1 02:59 magick-37072lAYUvoSex9wk
-rw------- 1 owner group 31457280 Dec 1 03:00 magick-37073XLevidVmQCPl
# more follows ...
-rw-rw-rw- 1 owner group 87155 Mar 26 2019 minify_0dca26f4ae4988d406871896dc562350
-rw-rw-rw- 1 owner group 15260 Mar 26 2019 minify_0dca26f4ae4988d406871896dc562350.gz
-rw-rw-rw- 1 owner group 85916 Mar 26 2019 minify_2972bf58405bbbc339884b94935eb6bf
-rw-rw-rw- 1 owner group 17938 Mar 26 2019 minify_2972bf58405bbbc339884b94935eb6bf.gz
-rw-rw-rw- 1 owner group 12447 Mar 26 2019 minify_67325ffb44e64f839c31db871aa8f6de
-rw-rw-rw- 1 owner group 2824 Mar 26 2019 minify_67325ffb44e64f839c31db871aa8f6de.gz
-rw-rw-rw- 1 owner group 185518 Mar 26 2019 minify_f8189fe934d7fecd140658eef38fcf74
-rw-rw-rw- 1 owner group 34816 Mar 26 2019 minify_f8189fe934d7fecd140658eef38fcf74.gz
-rw------- 1 nobody root 2227 Apr 25 2014 mNQtmxm4OS
-rw-r--r-- 1 owner group 0 Apr 28 2015 msans.ans
-rwxr-xr-x 1 owner group 741 Apr 28 2015 msans.ksh*
-rw------- 1 mysql mysql 0 Jun 19 2018 MYchYpJx
-rw-r--r-- 1 owner group 0 Sep 12 2017 mysocket1337.tmp
-rw-r--r-- 1 owner group 386 Oct 21 2014 no.worries
drwxr-xr-x 2 owner group 4096 Oct 21 2014 okold/
-rw------- 1 owner group 0 Jan 11 2017 pdfFafOZA

Those magick-* files seem problematic! Do you think a look around the net would reveal anything useful?

Astounding! Look at what are ‘/tmp/magick-*’ files? – ImageMagick

When IM can’t do its work in main memory, it uses disk. If the process completes normally, the temporary disk files are deleted. If the process fails, these files are often not deleted.

If you have no IM processes running, you can safely delete these files.

Knowing that, and seeing the dates of those problematic /tmp/magick-* files, am I right in thinking you’ll tabulate a short term and long term strategy remedy to the problem?

And do fish swim?!

Short term strategy Long term strategy
Within ksh shell script that crontab runs each minute, add (allowing 40 minutes before saying the ImageMagick must have failed) …

$ rm -f /tmp/magick-*
$ df -k /tmp # Sanity check gives "/usr/tmpDSK 544256 24428 492180 5% /tmp" ... much better
$ curl HTTP://www.rjmprogramming.com.au/PHP/tutorial_options.php

ksh -c 'for i in `find /tmp -name "magick-*" -atime +40m`; do rm -f $i; done'

Feel free to see a PDF stream of consciousness presentation of us dealing with this issue.


Previous relevant Landing Page Mobile Phone Crontab Curl Tutorial is shown below.

Landing Page Mobile Phone Crontab Curl Tutorial

Landing Page Mobile Phone Crontab Curl Tutorial

That work with the RJM Programming Landing Page we were last looking at a couple of days ago (with Landing Page Mobile Phone Tutorial) was all fine and good, but the introduction of a new HTML indexmobile.html for mobile phone usage, specifically, needs melding into existant web server arrangements.

For the most part “web server arrangements” has little to do with HTML and Javascript, which is usually client side work, unless, perhaps you involve Ajax.

But even ignoring Ajax, and ignoring server side languages like PHP (or ASP.Net) … remember …

As we continue in this series of tutorials we don’t pretend to be experts on aesthetics but we will show you some HTML and Javascript (no PHP, deliberately (read Linux sudo nohup Watchdog Primer Tutorial to get this in context, for us)) functionality ideas that could supplement some great graphical design ideas you have to start something yourself, perhaps.

… from Landing Page Primer Tutorial … how can HTML (with its associated Javascript) make use of “web server” anything much other than being a place it gets stored?

Well, that web server is a server … a computer … with its own processes … ours is a Linux web server “computer” … with batch processing capabilities … easiest to access via crontab, and we first talked about how the RJM Programming Landing Page could be supplied with an HTML select element filled with RJM Programming blog tutorials with the most recent ones up the top, via the “crontab” running of a PHP web application that reads the WordPress MySql database to derive the contents of this HTML select element plonked into the Landing Page when we presented More on Linux Crontab Curl Tutorial as shown below.

So here we have a before and after scenario … that doesn’t involve hair nor weight loss … so here is the crontab before (which we’ll keep but add another similar process onto) combining its talents with PHP and curlthe “CC dynamic duo”


59 23 * * * curl //www.rjmprogramming.com.au/PHP/tutorial_options.php 2> /home/rjmprogr/public_html/PHP/tutorial_options.bad

… but we need to tell you a great thing about curl … you can access, easily, a single $_GET[] PHP parameter, because Linux doesn’t think “?” is very special (but it does have a “background process meaning” for “&” making it hard to use curl with more than one $_GET[] PHP parameter involved) … leading us to our new bold crontab record below to cater for “indexmobile.html” updating …


59 23 * * * curl //www.rjmprogramming.com.au/PHP/tutorial_options.php 2> /home/rjmprogr/public_html/PHP/tutorial_options.bad
57 23 * * * curl //www.rjmprogramming.com.au/PHP/tutorial_options.php?mobile=mobile 2> /home/rjmprogr/public_html/PHP/tutorial_options.bad

… and what needed doing with the PHP?

Here is the downloadable PHP programming source code you could call tutorial_options.php changed for the purposes of being capable of updating “indexmobile.html” as per this link.

The effect on mobile phone usage of the RJM Programming Landing Page tutorial dropdown (HTML select element) list of RJM Programming blog tutorials (updated daily) is seen with today’s tutorial picture.


Previous relevant More on Linux Crontab Curl Tutorial is shown below.

More on Linux Crontab Curl Tutorial

More on Linux Crontab Curl Tutorial

Sometimes for a website you only want to do a web server task once or a few times a day, and you, ideally, wouldn’t want to run into the remote possibility that two people could perform the task at precisely the same time. This scenario happens often when using server-side languages like ASP.Net and PHP. If it didn’t matter that two people might do the same thing at once then you could do the job within your web-based PHP, and you may consider using a date and time test in your web-based PHP to do your “once or a few times” task in your PHP. This latter idea has the advantage that file ownership issues will probably not crop up because the web user will be manipulating any media or HTML files you may be dealing with, rather than the administrator user that will probably be overseeing your “once or a few times” cron job that we show you here today.

So the task today is to keep the rjmprogramming.com.au’s landing page “Tutorials” dropdown up to date with the latest blog postings, rather than having to manually attend to this with interactive (HTML code) edits and (s)ftp uploads. You may be wondering why not just write the landing page in PHP, and this is a fair point, but the strategy here at this domain is that the landing page and its “fellow” webpages should be independent of MySql, which, under big loads, can go down, and here we use a watchdog to fix that, should it happen. Previously we had a very similar task you can read about with the Linux Crontab Curl Primer Tutorial below. It is so similar, let’s use curl, PHP and crontab to do this task like with that previous task. So this is command line, and this is batch work, but that worry in other types of batch work where you need to worry about where you are as you do any file management, is handled quite well by the wrapping of the job in curl, which takes as its argument a URL, so, implicitly, the place to work with file management, is handled by curl and the PHP we write (specifically where the code uses dirname(__FILE__)).

Here is the downloadable PHP programming source code you could call tutorial_options.php and you will see, if you examine the code that it is very specific to conditions here at this rjmprogramming.com.au domain, so please be aware of that, but maybe its concepts can help you out with something else you are tackling. A list of the specifics you would want to address (should you adapt it for your own purposes) include:

  • the PHP explode methodology (in the code above) assumes there are two select dropdowns (spelt in lowercase) in the underlying HTML code (for rjmprogramming.com.au’s landing page) we are rewriting, and that it is the second one we update with information gleaned (via SQL query) from the WordPress MySql database the PHP reads (where we piece together a $retval string of the HTML option tags belonging to the tutorials HTML select tag)
  • the MySql database access hostname, username, password, database name, database table name
  • the Linux web server file owner used during the (commented out) chown command you may need to consider to allow the crontab’s user be able to leave the files owned by the website user

PHP commands of interest in today’s tutorial include:

Maybe it is just me, but liking “Onion of the 4th dimension” the kind of thinking I gravitate towards is:

  • supervisory command line arrangements
  • all “replace” type functionality … to get the problem into a shape suitable for the bits down deeper into the “core” of your “onion” … Linux-speak would say “kernel” of your “onion”
  • parameters and arguments … continuing on that theme of slotting something (the user is specifically interested in, data-wise) in dynamically for something that “represents” it in the code … sort of, like an “interpretive” approach (often people like to say “scripting”)

Programmers can think in entirely different ways, and if other methods work then that is great (woh!) but if they do not work for any platform (sometimes you don’t intend to cater for every platform known to humans and mangoes … damn … was doing so well … persongoes), and these ideas may really irk many programmers, but you need to consider styles of work that suit your way of thinking best.

So, to do this task we wrote new PHP code and cloned the crontab code used in the tutorial below but change the minute of the hour the task is run, and what is run, in crontab on the Linux web server for the domain at rjmprogramming.com.au … happy studies!


Previous relevant Linux Crontab Curl Primer Tutorial is shown below.

Linux Crontab Curl Primer Tutorial

Linux Crontab Curl Primer Tutorial

Linux (or Unix) is a command line environment that supports interactive and non-interactive task management. Often non-interactive tasks are known as batch processes, often intended not to rely on any user intervention, unless there is a problem.

Today, in this tutorial (which builds on Linux Background Primer Tutorial), we see the power of combining Curl under the auspices of crontab to run a webpage piece of functionality once a day at a specified time.

Some CMS systems like Drupal use crontab to perform actions on the database at regular intervals.

For Windows systems you might want to look at Windows Task Schedular for similar functionality.

Linux has several approaches to activating a task, some (not mentioning all the ways one process can fork or launch another process) of them being:

  • interactively (from the command line)
  • kick off a process from command line, and place in in the background, without supervision, necessarily, via the suffix &
  • kick off a process without supervision, necessarily, via crontab
  • kick off a process in the background (without supervision, necessarily) via nohup
  • kick off a process from command line, and place it in the background, without supervision, necessarily (and optionally change its state via fg and bg)

The previous Linux Background Primer Tutorial is well worth reading below.

Linux Background Primer Tutorial

Linux Background Primer Tutorial

Linux (or Unix) is a command line environment that supports interactive and non-interactive task management. Often non-interactive tasks are known as batch processes, often intended not to rely on any user intervention, unless there is a problem.

In the pre-GUI days batch processes were very prominent, but they still are today, as far as actually getting things done. It is just that the more glamorous activities pass our notice more, but there are servers out there churning away with batch processes, dreaming of the day when they’ll work out how they can make that cup of coffee for you in the morning. And do we ever offer them even a cup’o’tea … it’s a disgrace, so it is.

Linux has several approaches to activating a task, some (not mentioning all the ways one process can fork or launch another process) of them being:

  • interactively (from the command line)
  • kick off a process from command line, and place in in the background, without supervision, necessarily, via the suffix &
  • kick off a process without supervision, necessarily, via crontab
  • kick off a process in the background (without supervision, necessarily) via nohup
  • kick off a process from command line, and place it in the background, without supervision, necessarily (and optionally change its state via fg and bg)

The last four above are often best performed on a shell script, whether that be a Bash, Korn, Bourne or Cshell script. There are some good general tips for batch process scripts:

  • never assume where you are, rather specify the directory to be in, via “cd”
  • never assume that the environment variables will be exactly the same as for an interactive session
  • be more thorough to log errors and log activity to files to see, later, what happened
  • it is not good to proceed on errors (unless you have set up independent means of checking) because there will be no human to interactively decide that the problem should not stop the job proceeding
  • pretty obviously, don’t expect anybody to answer an interactive entry requirement (but you can simulate lots of interactive input via redirected standard input eg. < [filename])

Take a look at some example Linux background processing at this tutorial. In it you will see some crontab work where the parameters are (as explained here … thanks):

MIN = Minute 0-60

HOUR = Hour [24-hour clock] 0-23

MDAY = Day of Month 1-31

MON = Month 1-12 OR jan,feb,mar,apr …

DOW = Day of Week 0-6 OR sun,mon,tue,wed,thu,fri,sat

COMMAND = Command to be run Any valid command-line

The */6 * * * * /Applications/MAMP/htdocs/pdftoimage.sh of our usage runs /Applications/MAMP/htdocs/pdftoimage.sh every six minutes.

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


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


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


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


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

Posted in eLearning, Event-Driven Programming, Operating System, Tutorials | Tagged , , , , , , , , , , | Leave a comment