Tag Archives: pipe

How to test if a Crontab is working in Ubuntu CodeUnit 15 JUN 2012

Editing your cron jobs with the crontab -e command will ensure that your crontab is at least syntactically correct, by not installing it unless it is a valid cron file.

Outside of that though, it falls to you to test that your jobs are in fact running correctly. This can be achieved by piping the cron command output to a file that you control for each one of your jobs.

In practice:

00 01 * * * bash mycommand1.sh > /tmp/mycronjob.log 
00 02 * * * bash mycommand2.sh > /tmp/mycronjob.log

And in the same vein, you can check that the crontab as a whole is being executed by creating a job right at the end of the cron list that runs every minute and pipes out its output to a file that you control:

*/1 * * * * echo "Success! $(date)" >> /tmp/cronwatch.log

Note that > means rewrite the target file every time, whilst >> means append to the end of the file (and create if not exist).


Related Link: https://help.ubuntu.com/community/CronHowto

Using a jQuery selector on an ID containing a Pipe (|) Character Programming 24 FEB 2012

I’m quite fond of using the pipe (|) character in tag, id and name properties because it just seems visually such a great delimiter to use when stuffing a string full of useful information to be extracted via splitting or exploding at a later stage.

However, here’s a nasty one which you might not be aware of – jQuery selectors do in fact no enjoy special characters like the pipe ‘|’ – for the very reason that it’s a special character!

So running a selector on an ID which contains a | in the normal fashion will fail (i.e. not find anything):


To get around identifiers that use special characters like our friend the |, you need to delimit it so:


And now you know! :)

Ubuntu Terminal: How to Pause ls Listing CodeUnit 17 AUG 2011

To list the files and folders of a directory while running around in an Ubuntu terminal you use of course the classic ls list command. But what if the list it returns is particularly long? Is there a way to pause a ls listing so that you can follow what is going on?

The easiest way to achieve this is by piping the results of the ls command through to the classic more or newer less command. In practice:

ls -lh | less

Now the ls command will begin scrolling through all the files and folders in the selected directory until the page fills. From this point you can use the up or down arrow to either scroll backwards or forwards, of the page up/page down keys to hurry things up a bit. Pressing q will quite the operation.


Rolling Back the Carpet My Life 11 JUN 2010

Whew. So Chantelle had Cliffie, the plumber/maintenance man they use at Gordon’s Beach Lodge come and have a look at the leaking geyser and it turns out that thankfully it wasn’t the geyser at fault at all! Instead, one of the copper pipes feeding into the geyser had corroded enough to from a small hole the size of a pinhead, causing a perpetual spray of water against the geyser at a rate fast enough to fill up a cup withing a minute.

This water then ran down the geyser and soaked into the cement below, basically spreading throughout the study and coming up to soak the underfelt of the carpet, making those big wet spots that had alerted us to the problem in the first place.

So after a bit of a hunt to find the water mains, Cliffie cut out the bit of offending pipe and welded in a replacement, meaning that the water leakage has now been stopped.

However, it isn’t all a field of daisies just yet.

Now because it is a pipe from the structure and not the geyser that caused the damage, responsibility for repairing it now falls to the complex management company, namely Micsam, which means that they are now liable for the costs. Already Chantelle has entertained some people to assess whether or not the carpet can simply be lifted and cleaned, but as the underfelt is already completely soaked and ruined, I’m afraid that the verdict is that the whole thing will have to be lifted up and replaced.


Anyway, so now it falls to us to clear out the study, roll up the wet carpet and then allow the cement to dry out for a couple of days, before the team rolls in and fits in a replacement.

Sigh, and of course it is the perfect timining for drying out wet cement floors of course! :P

(On a side note, Olympus seems to love the exposed underside of the carpet. He runs up and takes a flying leap over the wet cement – refuses to walk on it – lands on the other side and proceeds to sharpen his claws on the underside. Perfect furry fun in other words!)