Logrotate: Does what it Say on the Tin

Linux has powerful logging capabilities that can be invaluable when diagnosing a problem, but when left unchecked can amount to a sizeable amount of your hard disk being consumed. How big? Well when I was starting out with Linux a couple of years ago, I didn’t know that such detailed logfiles were being stored; so went along my merry way until one day I stumbled across a 300+MB messages file in /var/log/. The problem was that my computer was never on in the early hours of the morning when the logrotate cron job was set to go off.

As you can guess this is oriented towards Linux being used as a desktop, but feel free to edit parts of this as you go along to accommodate for a longer log-life. All the instructions in this post need to be run with super user privileges; so use sudo or su. First up is to edit the logrotate configuration file:

pico /etc/logrotate.conf
# For more details, see “man logrotate”.
# rotate log files daily:
daily
# keep 7 days worth of backlogs:
rotate 7
# create new (empty) log files after rotating old ones:
create
# uncomment this if you want your log files compressed:
#compress

That’s how my configuration file is laid out: it creates a backup of all the log file daily and starts overwriting the first at day eight. You can test your configuration by going:

logrotate -f /etc/logrotate.conf

So what’s cron? cron or crond (the cron daemon) is like the Windows Task Scheduler. It uses a simple syntax to run your scripts automatically at a given time. To make it easier, it also provides the concept of run parts to run everything in a directory, so you don’t have to edit to accommodate for every single script you want to schedule. For instance if you want a script to run daily, just plonk it into the /etc/cron.daily/ directory and you’re done.

Of course the next logical question is when do the cron.daily scripts get run? Well they’re probably going to be running early in the morning when your desktop is turned off, so you’ll want to fix that by editing through a convenient little program called crontab. Crontab is basically the vi editor set up to edit cron files. Vi can be a pain, so if you’re not used to it have a look at this excellent quick reference. The run parts, that is the cron.daily/weekly etc. directories should be run as root, so edit through crontab:

crontab -e root
[snip]
# Run daily cron jobs at 20:40 every day:
40 20 * * * /usr/bin/run-parts /etc/cron.daily 1> /dev/null
[snip]

Now you’re done, just make sure you actually have the logrotate script in the /etc/cron.daily directory, and that it has executable permissions, if you don’t then it should go something like this:

cd /etc/cron.daily/
touch logrotate
pico logrotate
#!/bin/sh
/usr/sbin/logrotate /etc/logrotate.conf
ctrl-x yes
chmod 750 logrotate

 

Motivation

Over the last few weeks I’ve been having some problems with motivation. There are really two problems: the lack of it and having it in the wrong places. I’m mostly back to normal, but now I really want to redefine what is normal to me. Moreover I already know what I felt as normal behaviour two years ago is different to what I feel now. Really I’m part of the way to achieving my aim–I know that I have changed, so it’s logical to think I can change again. Of course the problem is that while changing over years has been a subconscious process, the new change will have to be an active conscious process.

The End

This is where you want to be, and you have to define what your end is so you can reach it, and not get sidetracked. Motivation can be incredibly dangerous since once you’ve got it, by definition your life should become consumed by it. Motivation seems to be associated with advancing your career, or earning more money, but really it should only be in what gives meaning to your life.

You don’t want to become an obsessive business type who only values their career for their career’s sake. But that’s not to say that you shouldn’t aim to be rich and good at your career. You shouldn’t have any delusions; money is the springboard that brings you to meaning behind your life–but what about relationships and things you cry? Well, I’m sure you can appreciate that even if you have the most appealing personality in the world, you’re going to find it extremely hard to show it to anyone when you’re in the gutter and preoccupied with finding your next meal.

Though there’s a problem: once you have achieved something that you want, you can’t just burn the bridges you travelled along to get there. Take the example of someone travelling around the world, while you should take time off work, you can’t just pack it in altogether. Sure you want to add meaning to your life, but you’ve also got to make sure you can enjoy the things that add meaning, and to do this you have to do things that will be less desirable. You can have the most extravagant aims and desires, but to succeed in them you’ve got to be realistic. Being realistic doesn’t mean that you should compromise your dreams, instead it’s just a way of achieving them. Once you’ve got things like taxes sorted out then you are in a much better standing point to achieve.

Risks

Have you ever seen the film Collateral? There’s the perfect example of someone who never gets any closer to what they really desire because they don’t want to take risks. I can’t remember the specifics, but Jamie Foxx plays a taxi driver called Max. Max insists that driving a taxi is only a temporary job, but it comes to light that he has been doing it for years, and his real desire resides in a photo of a beautiful island that he looks at every so often when he’s feeling down. It isn’t the fact that he has a job as a taxi driver, but instead that he wishes he hadn’t. You’re never going to change anything unless you actually do something, and sometimes doing something is risky. I’m not telling you that it will always turn out right, I’m just saying that’s the deal: it doesn’t always turn out right.

Resentment

It isn’t humanly possible to be 100% focused on your aims 100% of the time. This fact means that sometimes you might resent yourself for spending time on things that don’t seem to contribute in any way to your plans. Also there’s the fact that sometimes you are incapable of trying to learn something new, or doing something you know you need to do to advance. An example of this is having writer’s block, I used to hate myself like mad when I couldn’t put something down onto a piece of paper. The answer? Do something different quickly before you start associating creativity or writing with a bad feeling. I used to find swimming or going for a walk helped. Physical exercise fills your body with natural endorphins that make you feel more relaxed and with that sometimes more creative.

Some days everything will just slot into place, other days nothing that you want to do will work. The trick is finding something that you can do on those days when you think you have no control over things that is guaranteed to make you feel at the steering wheel again. Don’t keep up a futile struggle of plugging away at something when you know things won’t work, the second you associate something with negativity makes it all the harder to pick it up and try again some other time, because you’ll have the preconception that what you’re trying to do will only make you feel bad.

This is different to patience and perseverance. This isn’t an excuse just to give up on something, I’m saying do something different if you find yourself getting in the state of mind where you think it’s totally futile. Perseverance is all about sitting down to do something hard with it in your mind that you can do something and you will do it–even if it metaphorically kills you.

Micro Managing is not a Necessity

While some people might find that micro-managing is the most productive way of achieving things, I can’t agree. I find that micro-managing in theory is much easier to do than in practice. Also the time it takes to devise a to-the-hour schedule could in itself be better spent on other things. When I was revising for my exams, I can remember teachers actually giving us time in lessons to create a daily revision plan, recommending to give each subject an allocated hour in your day. I found this to be entirely impractical, however this does vary person to person–someone else may find micro-managing the ideal way of doing things. But I just find that if you plan everything too carefully, and don’t allow for the unexpected, then your carefully laid plans can go to waste, making your day feel unfulfilled. If you know that you have to do things like revise for a lesson, make sure you do it, but be flexible. Also you might just feel like doing something on the spur of the moment, as the saying goes: “There’s no time like the present”. Have a mental list of what you want to do in a day, but I think it’s going a bit far to say “this is when I’m doing this, and this is when I’m doing that”.

Stop Pissing Around

The elegant term for this is procrastination–go to any affluent teenager’s blog and you’ll probably hear this word mentioned. Procrastinators are perfectionists; it’s a vicious circle, they want to achieve perfection, but don’t want to go about doing so unless they know they can achieve it. I always use the word piss around instead of procrastinate as the former has more negative connotations. Correct diagnosis is the first step to a cure, and using such an elegant term for such a crappy state of mind is doing yourself no favours.

Carefully Balance Inspiration and Achievement

I find films to be a great source of inspiration, seeing people on the screen who are successful in whatever they do makes me want to emulate their behaviour. Eric S. Raymond’s How to Be A Hacker was one of the catalysts that got me interested in the field of computing. However I am quite aware that there is a difference between walking the walk, and talking the talk. You’ve actually got to knuckle down to things yourself instead of reading endless things like: “Which is the right distro for me?” Or “Which programming language should I learn first?” You’ll find yourself trawling the internet addicted to hearing about what other people recommend. I think you just have to get to a where you should dive headlong into something, and make your own mistakes.

For instance there’s no better way to realise the benefits of Object Oriented programming than to realise you can’t salvage anything from the code soup you created a couple of months ago–it having all made sense at the time. In the case of Object Oriented programming it sometimes takes longer to implement something using classes than what it does to implement something procedurally, but in the long run you can go back to it and access everything through the logical abstraction you created. This is an example of putting more effort into something for the long term instead of focusing on short-term gratification. For those among you who are not programmers, here’s how I would connect to my database with PHP:

$connection = new DatabaseConn($password, $username, $hostname, $dbname);
$connection->connectToDatabase();

I think anyone can see that’s a pretty easy way to connect to a database.

Hypocrisy

So, there you have it, advice from a person who loosely follows what he says, but would like to follow it more.

Grokking the World

I’ve been themeing up GNOME again, and am quite pleased with the results. However I think GNOME’s Theme Preferences program needs a little work. It isn’t made clear to a newbie exactly how to install a theme, sure it says you can drag and drop, but that’s not much good if the newbie has instinctively untarred the folder, for GNU/Linux to be successful in the desktop you’ve got to design with the non-technical user in mind. Anyway, I’m sure a non-technical user can manage with a bit of help:

  1. Grab your theme from the Internet, Gnome-Look is a good place to start.
  2. Download it to your home directory, open up a console and move the archive to either the hidden .icons or .themes directories with the “mv” command.
  3. Go into Desktop → Preferences → Theme → Install New Theme and enter the path to the archived folder (probably something like /home/alex/.themes/foo.tar.gz)
  4. You should now be able to use your theme / iconset etc.

I also played around with the fonts a little bit. I’ve found that size 11 Bitstream Vera Sans is a lovely font to program in. Sure it’s not monospace but it’s damn sexy on the eyes! Actually, it’s so good that I’ve changed the GNOME font defaults so that other programs use it on their widgets. The anti-aliasing knocks the sock’s off Windows XP’s Cleartype.

About an hour ago I was at my old school’s awards evening to pick up my GCSE certificates. Special congrats to my good friend H. whose grade score averaged out as the best among the girls. Also congrats to my other friends who won something, whether it was community or academic related. Myself however am content with just my grades, it’s not my style to do any more than the expected.

It was actually nice seeing everyone again. I have a little saying:

Familiarity breeds contempt.

When I was at my old school I was sick of the constantly familiar surroundings and routine. Going back to it though, I feel slightly nostalgic, maybe not so much for the place, but for the people. Though saying that, my saying also applies to people generally, I think it’s easy to take someone for granted if you’ve known them for a long time.

Anyway, when we left the awards hall it started to snow outside, which certain Australian readers might be interested to hear. Apparently we’re going to have a cold snap over the weekend. Anyway, before I get any more boring, here’s a screenshot of my new desktop:

Grokking the world…

Slackware & Gnome

Since the announcement that GNOME wasn’t going to be included in future versions of Slackware, GNOME lovers basically have three decisions:

  1. Dropline
  2. GWARE
  3. Freerock / Gnome Slackbuild

Well, four if you count switching over to a different Desktop Environment. Though saying that, it is actually helpful having KDE installed for Qt applications that don’t play nicely with GNOME. By playing nicely I also mean looking aesthetically pleasing, which accounts why I always boot up KDE when I want to use Scribus.

I have had experience with both GWARE and Freerock. Some potential confusion surrounding Freerock is that GNOME Slack Build is also available to download. Though it’s pretty simple really: GSB is just the collection of scripts they use to create Freerock–the actual .tgz packages you’ll want to download and install. GWARE and Freerock are essentially the same, but I currently use Freerock as it has more features, accounting for the size difference between the two. The only problem I came across when using Freerock was that the clock applet didn’t work:

The panel encountered a problem while loading “OAFIID:GNOME_ClockApplet”.

This was easily solved by installing the extra Firefox packages that reside in a different directory to the main FRG packages. These create the necessary sym-links to allow the clock to find the dependancies it’s missing. Also be careful uninstalling particular .tgz packages as this might cause further dependancy problems. For instance Evolution is also required for the clock to work because of the calender functionality. To track any missing dependancies try:

ldd /usr/libexec/clock-applet (or as required)

Dropline GNOME has a long controversial history, providing an alternative release of GNOME for Slack users for a long time. It’s obvious Patrick Volkerding doesn’t like the way they replace core parts of Slackware like X.org. Read over the frequently unasked questions for more. Moreover, it can be said that all of the above will replace a few original Slackware .tgz packages, but that’s pretty obvious.

So why bother with it all when there’s KDE? Well for one I prefer the simplicity of GNOME, it generally looks a lot less cluttered. While there aren’t as many applications for GNOME, at least they don’t all start with K, ok that’s a little trivial, but I find it a little annoying. I also don’t like the way KDE is so closely tied with Trolltech’s Qt. Their open source licensing is ok, but if you even so much as breathe on a piece of closed source that utilises Qt, you’ll have to pay a heafty license fee. GNOME uses GTK, GTKmm etc. that have less restrictive licenses, allowing commercial developers to use the libraries without any repercussions, and this seems a better way to attract high quality commercial software into Linux. Oh, and did I mention the brilliant, practically commercial grade software GIMP and Inkscape are made with GTK/GTKmm?

 

MySQL Error 28

Sorry if you’ve been getting some errors when trying to visit this blog. Specifically MySQL error 28. This technically isn’t my fault, what happened was that the server this site runs on ran out of space in the temporary directory that holds the buffered tables some of WordPress’s queries need.

There are various fixes that are suggested on the internet. Using phpMyAdmin to repair the tables worked the first time, but the problem remained. The way I solved it was to spuriously delete folders in the /tmp directory, well just those unwieldy web statistics programs. The problem seems to have cleared up, but to be on the safe side, I think I’ll look into using the MySQL server supplied by my ISP.

One more thing: backup, backup, backup your files!

MySQL Nightmare

Well my problem resurfaced. I moved the database across to the MySQL server my ISP provides, I don’t know what the speed will be like, but at least you won’t be getting any more error messages.

I’ve sent an email off to my host, they’re usually good about these things, so hopefully I’ll be able to move the database back again soon. I like everything in one place.

I went to see The History Boys in Norwich yesterday, I was going to write about it, but as it is the end of my half term holiday I have had to knock a hole in the metaphorical dam (damn) of homework and have been somewhat deluged.

The Nano Screen Issue

Or the not-so Nano screen issue.

Watching the adverts for the new iPod Nano fills me with mixed emotions. I for one held off from spending well over £100 on buying any kind of iPod. When the first one came out you could feel the hype. But as we all know in the world of technology bigger, or in this case smaller, less expensive, and better things will always leave you with that nagging feeling of wishing you’d waited just a little longer. Of course you have to balance this out with actually having to wait and miss something you want for several months. For example I didn’t mind paying a little extra for a good digital camera, as I took some worthwhile photos that otherwise would not have been taken if I waited.

iPod Mini owners might be slightly peeved with the release of the Nano, but also might be smirking slightly with stories of scratched LCDs and cases. A once proud owner of a Nano might be a little more irrate having spent a sizable amount of money for something so easily scratched. Or you would have thought considering the amount of bad press it has been getting.

I have seen how some people treat expensive electronics, so I’m a bit skeptical. I wouldn’t keep a Nano in the same pocket as keys anyway. I’ve dug up a nice Nano stress testing link for you to make up your own minds on the durability of the thing. Though personally I’m sticking to old fashioned minidiscs for a little while longer.

FatCow: Hold On!

When I Laid On FatCow

Thanks to its expertise and support systems, FatCow review articles are full of praise for the two-decade-old company. FatCow, with its state-of-the-art features and services, continues to be leading the pack mainly because of its productive and cost-effective services.

Lies about Hosting

If individuals are still skeptical on an Internet hosting service that is reliable by over 150,000 domains, then a FatCow Review can give a moderate review with respect to the advantages of the specific service. Offering up valuable information for undecided individuals, FatCow Reviews can be of help in choosing what Internet hosting service to pick from.

The following can be evaluated in a FatCow Review: customer assistance, price, dependability and uptime, software, space, tech support, traffic, user-friendliness, etc. However, a FatCow Review may have factors that most individuals are unable to completely understand.

To FatCow I say Yes

A FatCow Review provides lots of statistics and records for those in search of an Internet web host to springboard their internet sites, and these reviews are authentic as customers are usually the authors.

Web Hosting and Reviews

An honest FatCow review is a comprehensive overview of the online webhosting service FatCow completed with the objective to help clients and potential customers trying to redress their problems regarding FatCow.

Take your Websites into Good Hands

The price and features of a website hosting package like that of FatCow will help you choose a company which is best suited for your requirements. The job of a website hosting package is: First, to manage your web space or the main file. This folder contains important website hosting system files such as your public_html sub-folder which allows people to view your website as long as you want. Another task is securing your website content.

Managing the set of tools (Control panel) which is available with the package and allows you to utilize the functions such as e-mail account creation etc is the 2nd job.

Samsung’s New Foldable Tablet Patent

A design patent for a tablet with a flexible, foldable display has been awarded on 31 December 2013 by the U.S. Patent and Trademark Office to the South Korean manufacturer Samsung. In the patent, the device is called “Portable multimedia terminal”, the patent is valid for 14 years.

iceOn the submitted drawings a Tablet looks like an ordinary Tablet, but a back Division reveals at the top and bottom. The user can close the Tablet, it is separated in the middle of the back and consists of two parts.

New and revolutionary ideas continue to make our lives better and more comfortable. I don’t have to go far to find another great example of this. Web Hosting Hub is a new web host that has built up quite a following in a very short time. You can read a review on Hostingmanual.net. The hosting industry is also evolving fast.

Thanks to the flexible screen, the display only consists of a Panel and is interrupted not by hinges . On the drawings, the tablet can be folded completely – it is unclear how Samsung wants to prevent any kinks in the display. However, the design describes only a design idea and not a specific device. On the back the Tablet has a camera, even a slot for a pen S is visible.

Samsung has already experimented with flexible, Bendable displays. The so-called Youm display was already introduced at the Consumer Electronics Show (CES) 2013. With the Galaxy round, the manufacturer has introduced a Smartphone with curved, but not flexible screen on the market. Other devices with unusual displays are planned.