From the BBC Article http://news.bbc.co.uk/1/hi/uk/7374265.stm at comes this gem:
“Legally, a lollipop lady has the same power as a red traffic light.”
Priceless!
From the BBC Article http://news.bbc.co.uk/1/hi/uk/7374265.stm at comes this gem:
“Legally, a lollipop lady has the same power as a red traffic light.”
Priceless!
In the ongoing battle between Teletext and Fisher Price, one thing that comes up over and over again is the issue of using a GUI for administration tasks. I own a number of Apple Mac machines, and I still head for the terminal when I need to do any real work. I think Bob said it best last week when he explained that a GUI just doesn’t scale for some work.
Today, I got to rediscover this first hand. Picture the scene – someone somehow changed permissions on all files and directories below a certain point in a filesystem, when the original intention was to change just the directory permissions. So now we have a load of files with execute permissions set that shouldn’t, and a load of other files that some people can’t read that they used to be able to. We’re talking about around 1000 files, and at first glance it looks like our only option is a restore.
First glance is a moron, so we’ll send him to the back of the class and go with second glance instead. If we’re able to re-install and get the correct permissions, then we’re able to recover the permissions on this machine, see?
The first thing to do is to drop the new install onto a test box. Once we’ve done this, we can start to use the new install to find out what our current box should look like. We only care about files, so lets get a list of all files and their permissions. We can do this by chaining 3 commands together like so:
find . -type f | xargs ls -l | awk {'print $1 $9'} > filelist.txt
This gives us a file named filelist.txt with entries like the following:
-rw-r--r--./build/wget-1.10.2/src/retr.o
Ok, so lets make this file a bit more useful to us. We’ll edit it in vim and add a separator between those permissions and the filename. We’ll also change the permissions to a format that we can use with chmod. So once we’re in vim, follow these steps…
Remove that leading – as we don’t care about it and then add a separator (|) between the filename and the permissions
% s/%-//g % s/-\./-\|\./g
Now replace the permissions with the ones we need. You might need to run a couple of these variations
% s/rw-r--r--/644/g % s/rwxr-x---/750/g % s/rwxr-x--x/751/g
This leaves us with a file that contains entries like these
750|./some/file 644|./another/kind/of/file 751|./yet/another/file
Now copy this file to the broken machine, change to the same directory that you ran the first find command from, and lets fix this mess with a simple bash one line script. We’ll assume that you put the file in /tmp on the broken machine for this demo.
for i in `cat /tmp/filelist.txt`; do FILE=`echo $i | cut -f 1 -d "|"`; PERM=`echo $i | cut -f 2 -d "|"`; chown ${PERM} ${FILE}; done
That’s it – your broken box is now good as new and the app magically starts working again. It’s ever so slightly quicker than a full re-install or restore from backups don’t you think? It’s absolutely quicker and easier than trying to fix the problem one file at a time, and most importantly it gets your customer back up and running with the absolute minimum of downtime.
Of course, another strategy might be not to break it in the first place, but some things are just beyond my control.
Well, after my last post I gave it about 15 seconds to calm down and then hit www.writetothem.com and contacted my MP and my councillors.
When I’ve reported these covers as missing in the past, it normally takes several weeks before they are fixed, but today we’ve had new covers installed in less than 8 hours after the previous ones were stolen.
Maybe it was the ‘Think of the children’ line, but I’m still impressed they did something so quickly.
Now if they would just electrify the underside so that the bar stewards get a shock next time they try and nick them, that would be great!
I’ve just had another conversation with the Metropolitan Police, and I honestly don’t know why I bother.
You’d think that a few weeks after an elderly lady was beaten to death 300m from our front door, the police would at least be pretending to care about our area and take an interest – but you’d be wrong.
At about 11:25 today, our builder watched some blokes in a van pull up and steal 3 drain covers from in the road. Every time these go missing, they stay missing for weeks and cause a serious road hazard.
I immediately called the police station, and was reminded once again why I should never bother to get involved. First it took forever to get through to someone – the wait times are actually getting as bad as South Africa now. Then the pillock I spoke to was adamant that I couldn’t report the crime as it was not my stuff being stolen – I should call the council and report it to them, then they could file a police report.
So what, only a person currently being beaten to death can report a murder? You damn sure better have your panties round your ankles before you report a rape? Seriously!?
After I explained that while he was talking and wasting my time, the thieving bastards were at risk of injuring themselves by laughing too hard at what we jokingly call law enforcement in this country, he asked why I had not called 999 if it had happened recently. How many times have we seen things telling us NOT to call 999 unless it’s a life threatening emergency? So much for consistency – I guess what he meant was “Why didn’t you call someone other than me?”
Anyway, because I’m a good little shitizen, I called the council. 10 minutes and three departments later, I was finally cut off. Ah well, sod it – I hope none of the children from the school down the road get hurt in these holes, but I’m not going to make this my problem any more.
Moral of the story children? The cops aren’t here to help you so you need to help yourself. Like the wise man said, “People who are willing to rely on the government to keep them safe are pretty much standing on Darwin’s mat, pounding on the door, screaming, ‘Take me, take me!’ — Carl Jacobs on ASR”