Perforce Backgrounding

Recently, I whined about a technical problem I was having, where the ampersand from a Perforce trigger wasn't pushing the script it called into the background, which meant that the user was experience a slight delay (a shudder, if you will) when committing changes.

After a little conversation with the Perforce forum, I think I've got a working Ruby workaround. There's also an article about doing this with C, but I wanted to use Ruby.

Have the p4 trigger call a Ruby wrapper script to fork the process. I know I said I tried this, but what I learned was that Perforce is hanging onto the output pipes, so you have to break them first. You do that, and the process forks easily and the user no longer notices the script running. This is only useful, of course, for running this when you don't need the outcome to affect the commit.

$cat test.rb

fork {
$stdout.close $stderr.close Kernel.exec "/usr/bin/ruby /home/abbot/triggers/sleep.rb"
}

In the p4 trigger file, it's calling the test.rb script with a -W0 flag so that warnings don't kill it, but otherwise it is straightforward now. And I feel much better.

Need Perforce Help

OK, I've been staring at this for a week and I'm so stumped I'm feeling stupid. Can someone out there help me out?

Running Perforce (which is a version control system) on CentOS. I wrote a script that just pauses for a few seconds. It's called sleep.sh and looks like this:

$ cat sleep.sh

sleep 5

When you run it from the command line, it pauses, as one would expect.

I wrote another script to run the sleep script in the background. It's called test.sh and looks like this:

$ cat test.sh

/home/abbot/triggers/sleep.sh &

Now, when I run this from the command line, the ampersand properly makes the thing run in the background and I'm immediately returned to the prompt. There is no pause. Kind of an exciting script, isn't it?

I took the temp.sh script and make it a trigger in Perforce, like this:

Triggers:
    test change-commit //... "/home/abbot/triggers/test.sh"

The problem is, now on every commit, the system waits five seconds before finishing my check-in. It's not supposed to do that! Why is it doing that?

I know this seems like a silly script to do, but the larger problem is that I have a long-running ruby script that doesn't need to be able to stop the commit and so I don't want it slowing the users down. But if I can't even get the simple sleep command to background, I'll never get my real script to do so.

Honestly, any help would be appreciated.

Update: I tried a ruby fork and it didn't work either:

$ cat sleep.rb

sleep 15

$ cat test.rb

fork {
   Kernel.exec "/usr/bin/ruby /home/abbot/triggers/sleep.rb"
}

And the trigger file:

Triggers:
   test change-commit //depot/... "usr/bin/ruby /home/abbot/triggers/test.rb"

Update #2: Problem solved, I think.

Where in Nevada County: Lifestyle

This one is cropped. Where can you find this slogan on a big sign?

One would think that someone of my generation would hear "Lifestyle," and immediately think the words "Rich and Famous." But for me "Lifestyle" brings other connections...

Where in Nevada County: Big Rock

I really like this strange standing stone. It's pretty much all alone, and the crumpled texture makes me see faces and things.

What do you see?

Walgreens Wants to Be Walgreens Again

Or so the sign at the burger basin seems to indicate.

Golden Oldie

Now, this is what I call a full-service hotel. In my room's bathroom, hidden behind the door and next to the shower, was this:

Now, to be fair, I feel bad complaining about a hotel that gave me a free glass of wine, but I can't remember the last time I was in a place with one of these permanently mounted somewhere.

Pioneer Cemetery

I like cemeteries. Does that creep you out? Since I forgot to do a Where in NC this week, I thought I'd post these pictures from last weekend.

The cemetery over on Red Dog Road has some interesting features:

flowers in a grave

flowers on a grave

flowers for a grave

chimes on a grave

graves on a hill

grave with a rook

tall monument with stick

Windsor, Connecticut

This one was a rush job, since I stopped in Connecticut for only a one-day gig. (Good gracious, but it takes forever to get from this side of the country to the other.

chamber of horrors

This chicken was out giving tours, in spite of the horrible humid weather. Did I really used to live on the East Coast? How did I keep from melting?

ghost tours

What I like is that the chicken tour guide is keeping its options open. You can do either kind of tour!

abandoned KFC

This is where I should point out that I'm not a vegetarian and I do visit the occasional fast food restaurant. However, I thought this abandoned place was ripe for an explorer.

KFC long


This is another in the continuing series of wee toaty explorers, a project to keep me busy while I'm on the road. A nice summary is here.

The Dervish House (Ian McDonald)

I'm sitting alone at Big A, the root beer drive-in burger place on Nevada City Highway. Or maybe that's still Main Street? At any rate, I'm at a booth inside, because enduring the screaming kids is better than wilting in the car in the sun. I'm listening to my current favorite podcast, 99% Invisible. Roman Mars is talking about yarn and hospitals. I wonder if Roman Mars is his real name. For some reason this brings Bertie to mind and he is suddenly there, yanking on one of my ear buds.

"Hey. Hey. Anybody in there?"

"I'm in here, Bertie. Somebody's home." I move my food a little closer to my chest. "You do not have to shout."

"I'll have you know that I am not shouting. I am projecting. I have the utmost respect for the public and conduct myself accordingly and -- hey, I've read that book."

"Good on you." I look down at the book on my table. It's one of the Hugo nominees this year.

"I got a great business idea from it. You'll never guess."

"Oh, Lord."

"Geez, you usually wait until after before getting all down on my ideas. Which, by the way, is why you are still not rich. Even so, it's enough to hurt a guy right here." Bertie points to his mid-section.

"In your stomach?"

"No, no. In my gut." He makes a sound like a slowly deflating tire and this, combined with his sour-lemon facial expression, makes me think he is trying to mimic a hit to the solar plexus. It would be more effective, I think, if he didn't hold it a beat or two beyond the point of impact and actually lose his breath, so he comes out of it gasping.

"OK, OK." I try to be placating with my imaginary friends. "Tell me your TDH-inspired idea."

"Nope. You're going to be like that; you haveta guess."

I roll my eyes at Bertie's pout. "I don't have any idea--"

"Tsk. You're always telling us that we're merely figments of your imagination. If this is true, then you must know what I'm thinking."

He tries to smile intently.

"I don't--"

"And," he adds, one finger in the air. "For every wrong answer, I get one of your potato thingies."

By 'potato thingies,' Bertie means the odd, smiley-face shaped potato cakes that you can get at Big A. To be honest, they're kinda creepy anyway. I start thinking about the book. There's a character much like Bertie -- always scheming, coming up with dead-end business ideas that never really go anywhere. The guy in the book, for example, invented a golf game played in untenanted buildings.

"Nope," Bertie says.

"I didn't actually make a guess, you know."

"You were about to." Bertie takes a smiling potato thing and puts ketchup around its chin as if it were a sloppy vampire. "That guy was too much of a secondary character to inspire me. You'll have to try harder."

"You're going to sell stuffed animals packed in Mason jars." There is a point at which they try to describe wisdom of the crowds without using the term, but with stuffed animals in a sealed glass jar.

"No. I'm worried about the mold problem, there." Bertie takes another smiley. He stands it up between his teeth so that the little grinner is watching me from Bertie's mouth. Then he sucks in. No more smiley.

"It had better not be related to terrorism. Are you going to settle down and deal gas futures?"

Bertie looks at me sadly and takes another smiley. "Too many people already do that. What you want to find an underserved market, not one that's saturated. You'll just be skimming dregs."

"Can you skim dregs?" I wonder. "I think dregs are at the bottom."

Bertie spins the smiley like a coin. Then he flings his hands wide and swoops his head down to catch it with his mouth. The table reverberates with a whomp as Bertie misjudges the size of his nose and smacks it, hard. Still, he got the smiley, you have to give him that.

In Bertie's flailing, he has knocked over the bear-shaped honey jar. I am disturbed to see the fallen bear, because Big A does not put honey on their tables. Perhaps I am seeing a reflection of Bertie's spirit.

"Please tell me you're not planning to open a chain of restaurants called The Mellified Man?" I can see it now, pancakes and waffles with little coffins of honey. Good luck and good health for ever. But Bertie grins and takes the last smiley.

"Maybe we're not made up after all, big shot."

"Maybe." Or maybe I'm just not in touch with whatever it is in my brain that generates these fictional friends and family.

"Here's the idea. I got it from the kid." There's a boy in the book whose parents gave him implants to reduce his hearing. They were worried that a sudden noise might startle and kill him. Loving parents.

"You want to make implants to reduce startlement."

"I'm not sure that's a word, but we can probably use it anyway. It's not just for safety, you understand, but also for isolation and peace from screaming children and even for annoying horrible younger brothers."

Ah, it's clear now. Bertie is having an argument with his twin brother, Bob.

"You mean like--"

"Don't say his name, he'll appear!"

"If you're not imaginary," I tell him, "then you must think I'm magical or something to make people appear by calling their names."

"Whatever. This is going to make us millions. Keep it in mind." Bertie looks sadly at the empty potato thing tray and slowly disappears.

I shake my head and sigh. Bertie's idea will never work. Who would voluntarily stick something in their ears to block out the rest of the world? I eat a bit of salt from the tray and go back to listening to my podcast.

Where in Nevada County: A Dentist's Monument?

I found this wonderful monument to nothing in Nevada County. Do you know where it is?

Perhaps an optimist would say it is a monument to everything.

Look What I Made

It's a combination of Family Circus panels with random tweets. You can play with it here.

Better Hurry...

...down to the Safeway if you want this deal on soda. The sale will be over soon.

sale sticker

Fremont, California

Well, the rain finally stopped, which means this little explorer got a rude awakening.

wee toaty explorer in fremont

paint job

You have to be careful where you hang out.

vertical line

firework

parking lot


This is another in the continuing series of wee toaty explorers, a project to keep me busy while I'm on the road. A nice summary is here.