- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
You just did.
Admin
Admin
And FYI, "turkey" is actually named after Turkey: http://en.wikipedia.org/wiki/Turkey_(bird)
Admin
You're assuming PIDs are randomly handed out. I've debugged enough to notice that given a regular startup, the processes I start in order tend to be within a somewhat predictable range of PIDs. Keep restarting to debug and I get PIDs that are rather close to each other. Is this not the case with the particular OS in the OP?
Admin
How bad could it really be? It wasn't even kill -9
Admin
I think the lesson here is that when your number is up, you die.
Admin
kill issues the SIGTERM signal by default that can very well be intercepted. kill -KILL sends SIGKILL.
Admin
Admin
Admin
Admin
Can't agree more
[youtube]_-ErjlR0tbg[/youtube]
Admin
Remy's lack of sensitivity to other cultures is just sad. He talks about Turkish pizza and börek as if he wasn't a privileged, white, male, non-geriatric person of pallor.
CAPTCHA: jugis - There is no right or wrong; just wrong. Can we not escape the white, patriarchy harassment in even a simple CAPTCHA word?!?
Admin
Admin
I had a fun Cron issue a few months ago,
I wrote a twitter bot in PHP (Get it over with, I'm a web developer, it's what I know) that grabs the weather from the Yahoo Weather API, and posts the current weather in my city to twitter every time a specific page is loaded.
I set up cron to access the page every 4 hours, or so I thought, and it would post. Easy enough.
However, it would post again between 15 to 40 min later.
Turns out the twitter API wasn't allowing reposts with the exact same tweet. Once the weather changed, it would allow a tweet through. It was calling the page at 12:00, 12:01, 12:02 all the way to 12:59, then waiting until 4:00, 4:01...4:59, etc.
Changed * */4 * * * to 0 */4 * * * and it works great!
TL;DR: Sometimes bugs LITERALLY depend on the weather.
Admin
best article in a while :D
Admin
Admin
Nahh, mysqld kills itself randomly. :)
Admin
Wait, so you mean that my process won't always have the same ID every time it runs? Well than how am I supposed to know the PID????
Admin
Admin
Just found that in the HTML code of the article:
"Astute readers will notice this is an OSX listing of /etc. OSX does not use cron for scheduling, which is why the crontab file is size zero- I touched it just to generate this screenshot, because I was too damn lazy to fire up a VM of a system that actually uses cron."
Which is, of course, plain wrong. MacOS X does use cron and the crontabs are in /var/at/tabs.
Admin
Admin
In Linux, PIDs are allocated sequentially. PIDs will not be reused until pid_max is hit and it wraps back around. By default, it will have spawn 32768 processes before it starts back at the lowest unused int. This may seems like a lot, but keep in mind many processes are very short lived and threads are implemented as LWP (light-weight processes) which get allocated a PID.
Admin
Admin
So, every few days there happens to be a process with PID 21342 alive at 12:22. Chances are it's not the process that's running the critical server program. What then? Weren't there other noticeable odd behaviors on that machine?
That said, finding that line in the crontab is certainly WTF-worthy!
Admin
I wish I had a roulette wheel that would randomly kill off one of our support reps at our primary vendor.
Captcha: damnum - as in damn'num to hell!
Admin
Is there any good reason to ever have a hard-coded PID in a cron job?
Admin
Curry isn't an Indian word. Curry is the Anglicized word for 'kari', which means 'sauce' in Tamil.
Admin
Admin
Yes, a good reason to put a pid in cron is when you want to kill init. Init is always one. How else can disgruntled employees hide their intent?
Captcha: gravis. What pulls systems down. Anyone remember those game pads?
Admin
That's an awesome piece of code. I might implement it here ha ha ha!
Admin
TRWTF is that isn't one of the first things he checked. Whenever a server is acting up you probably want to check the cron tasks to see what, if anything, was running at the time.
Admin
Just to help some people out. It looks like the person only wanted to do this once. Kill a process around lunch time.
They didn't know the right way to do it, so they thought of cron. "Hey, I'll just put it in cron, and then sometime later in the day, take it back out of cron."
TRWTF is that they should have used the "at" command, close cousin of cron which will run a command once "at" a certain time. I've seen people that have "been using UNIX for 20 years", not know about "at".
The second TRWTF is cron.allow and cron.deny. Any sysadmin should have locked down cron to only accounts have a need for it. A user can't setup a poorly thought out cron job, if they can't use cron.
I have the second problem right now. A major app that was written long before I showed up at the current gig is a set of cron jobs set to run every few minutes. All the setup and logging overhead of the poorly written scripts just kills the server. If someone had prevented cron from being used for said app, they would have been forced to do things a much better way.
Admin
Yeah, but its irrelevant where a word comes from. What's important is using the word, instead of a description of the thing.
Admin
I don't speak linux commands well - what does that do?
Admin
Absolutely nothing. Linux protects the init process from userland kills.
Admin
Process 1 is init - the kernel. Kill -9 will terminate your machine with extreme prejudice. Unless you're running DEC Ultrix, where you could run multiple copies. Mind you, the server was unusable...
Admin
kill'ing init is just silly because nobody will really do that very often. kill'ing PID 1 is probably more common, but still not something you'd expect to see real often.
However...
Several years ago I was sitting in front of a Linux box and suddenly wondered what happens if you try to switch to an invalid runlevel. So I did what anyone would do.
Give that a try.
On my system at least, it did what any good program does -- exactly what you told it to. Init killed everything that wasn't supposed to run in runlevel 7 (everything), and I was left only init.
Oops.
Even more fun can be had by running killall with no arguments. I think this can vary by system, but I've seen it kill every single process.
is even better.Admin
See here's the thing. You're the butterfly fart.
Admin
Right or wrong, that's just how butterflies propelled themselves back then.
Admin
Did no one else have to Google "borek"? I'd never heard of it before. But I do like baklava which appears to be the desert version.
Admin
Just a pretentious bloody cheese toastie.
Admin
Don't be too sure of that. I can imagine them doing things in a much worse way, maybe even poorly reimplementing cron as a php web page...
Admin
That is unless it's something like a web service, PHP, Tomcat, Java something that runs itself on cron scripts, something that spawns a lot of processes and doesn't handle the premature death of it's children right...
Admin
I was really expecting this to somehow end with "if it ain't borek, don't fix it".
Admin
Nah, not buying it.
Personally, I don't think there is any sensible reason that anyone who understood enough to set this up, could give to explain why they would do such a stupid thing. I'm putting my bet on deliberate sabotage.
The more I think about the title of this, the more clever I think it is. Nice take on, "A Corny Joke".
Admin
Or, depending on the OS in question, the "processes" are actually threads, and a kill signal to the child is handled by the parent...
Admin
I think kill with no params defaults to SIGTERM on most systems....
need to explicitly specify SIGKILL(9) if that what you want
Admin
Admin
Admin