Linux Blog

Aim for the Simple, not the Turd.

Filed under: General Linux — TheLinuxBlog.com at 10:18 am on Wednesday, March 18, 2009

TurdWhen something doesn’t work as expected, or stops working, for your own sake try the simple things first. It may seem pretty obvious to most people, but sometimes we all need a reminder. Recently I have been over complicating problems and landing in giant piles of turd.

I was going nuts one day because I couldn’t listen to streaming radio while I was trying to work. I started messing with all the settings, reconfiguring my sound card. I Removed the sound module and probed it again. Turns out that the reason my headphones were not working was because the cable was unplugged. Hey! it happens with those Dell’s with the slanted front inputs, but I’m still stupid for not checking the speaker volume first.

Fortunately this one was not me, but is still a funny story and something I’m sure most technicians will be familiar with.
User: “I can’t connect to the network”
Tech: “Is it plugged in?”
User: “How do I plug it in if it’s wireless?”
Tech: “Oh, why didn’t you say? Are you sure you’re connected to the right network?”
User: “How do I tell? The thing that normally tells me is gone”
Tech: “Ok, I’ll be there in a sec”
The technician tried to reinstall the driver, change the firewall settings and everything possible. Turns out they forgot to ask them if they’d hit the wireless function key.

Fresh off of the stupid, this one just happened to me five minutes ago. I was switching my KVM over to my Windows machine. I got nothing but a black screen and monitor telling me it was going to bed. My mind told me that Windows had crashed as usual and that I better shut it down and restart. I pressed the power button and waited. I’m used to Linux shutting down pretty quickly so since it was taking its time, I thought it had properly frozen up like it sometimes does. I held the power button in for the dreaded five seconds, poured myself a cup of coffee and turned it back on. What? Nothing! oh yea, I was rummaging around down there yesterday. What’s this? A loose video cable? Crap!

Who’s the sucker now?

Next time you jump off of the diving board of problem solving just remember to try the simple solutions first.
I’d love to hear your stories, and the pile of turd you landed in.

Adjust sudo timeout

Filed under: Quick Linux Tutorials — TheLinuxBlog.com at 1:05 pm on Thursday, March 5, 2009

SudoI think its pretty evident that I love sudo right? Well, what I do not like about sudo is the timeout. I understand while its there but five minutes is not exactly what I’d call an overly generous time, especially when I’m parked here at my desk for hours upon end. This tutorial shows you the line you’ll need adjust the sudo timeout:

First as root you’ll want to get into the sudo file and edit it. I’m sure you know how to do this since you’ve probably already visudo’ed your way into using sudo and are now trying to adjust the timeout. For those just reading for the sake of it, you’ll do the command: visudo

Right, now you’re there, you’ll either be in nano, pico or vi depending on your distribution. Search for the Defaults section, and put

Defaults:[your username] timestamp_timeout=[your timeout]

Replace your username with yours. Change your timeout to the number of minutes, or -1 for unlimited per session. Save and quit, then exit. Try it again, then try it again after the sudo timeout you set has changed. If it works, great news if not double check your sudoers file for another Default property that may be acting up.

Crontabs 101

Filed under: Shell Script Sundays — TheLinuxBlog.com at 11:42 pm on Sunday, January 4, 2009

Although not necessarily classified as shell scripting its self cron’s are very useful to any Linux administrators arsenal. The ability to run tasks at a specific interval is a great way to schedule things to run later or when the system load is lower. Many applications use crontab to schedule tasks so its hard to say what yours will look like.

crontab -l

will list all of the cron jobs scheduled for the currently logged in user mine has an entry for kpodder

# (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp $)
#KPodder entries
0 0 * * * kpodder.sh -c "/home/owen/.kde/share/apps/kpodder/" -s "global.casts" -o "/home/owen/podcasts" -d 0
#KPodder End

The first five fields are to tell the task when to run. They are in the following order: minute, hour, day, month, day of the week. Asterisks are used to say any valid value and a forward slash can be used to make intervals such as five minutes, hours, days or months (*/5). A comma can be used for or values, so if used as 2,4,6 the cron would run at 2, 4 or 6 o’clock. Dashes are used for time spans, If you have an 8-5 work day you can use 8-17 if in the hours field.

Next, the sixth field is the actual program to run. It will look in the $PATH for the user, but for safety’s sake, I try to use the full path if possible. In my example of the kpodder script there are many arguments. I only really use simple crons and the number of arguments here seems rather excessive.

To edit the crontab do crontab -e. This will edit the current users crontab. If you are root and wish to edit a naughty cron from another user you use -u and specify the user.

Thats pretty much all there is to it. I’d love to here tips and how much people love/hate cron and why.

Happy Shell Scripting New Year,

- Owen.