Social security for getting on a large amount Beat The Cycle Of Debt Beat The Cycle Of Debt for an approved in addition questions.

Restarting Apache kills script

Posted: June 12th, 2012 | Author: | Filed under: Linux, Tech | Tags: , , , , , , , , , , , , , , , , , , | No Comments »

Another pretty specific problem.  If you have a bash script or any script that you gave sufficient privileges in the sudoers file and want the apache process to run.  If apache starts the processes directly with nohup or disown, etc. when you restart apache all of those child processes die. The workaround/logic is this:

1. Call initial php file through the browser

2. That file uses PHP Exec to call another php file through the command line

3. The command line PHP file forks twice and then calls whatever command/script that will be independent of the apache process.

 

Thanks to Jacob Kiers for having the ONLY site to describe this issue on the internet.
His site is here.

Our example

First file: 

<?php
$name = $_POST['name'];
exec(‘php ‘ . EQ_APP_PATH . ‘/scripts/thread_start.php ‘ . $name);
?>
Second file:

<?php

$name = $argv[1];
/* Fork once */

$pid = pcntl_fork();

if ($pid === -1) {
die(‘First fork failed!’);
} else if ($pid) { // if parent
exit(0);
}

/* Fork again (as session leader) */

posix_setsid(); // become session leader

$pid = pcntl_fork();

if ($pid === -1) {
die(‘Second fork failed!’);
} else if ($pid) { // if parent
exit(0);
}
exec(‘nohup sudo ‘ . dirname(__FILE__) . ‘/thread_start.sh ‘ . $name . ‘ > /dev/null 2>&1 &’);

?>
At the end of the above file, you call your script with nohup that will be independent of the apache process.
This way if you start the process with a webpage/apache, it will not die when apache is restarted or crashes.

 

 

 


Arcade Impossible – The Series (Coming Soon)

Posted: June 6th, 2012 | Author: | Filed under: Tech | Tags: , , , , , , , , , , , , , , | No Comments »

Just a quick post. Since I am in to arcade machines, and if you’ve read the previous posts on this blog you know.  Today we officially launched the youtube channel arcade impossible. It is going to be a youtube series where we look on ebay/craigslist/anywhere to find the arcade machines from the 80′s and 90′s, buy them, and try to build the best possible arcade, at home.

Follow along here:  http://www.youtube.com/arcadeimpossible

Please subscribe if it looks interesting! It helps!

Thanks,
Gregg


Donkey Kong Arcade Machine Restore

Posted: May 2nd, 2012 | Author: | Filed under: Tech | Tags: , , , , , , , , , , , , , , , , | 2 Comments »

Back in 2008 I was getting in to MAME arcade machines. I think I even have a few posts on this blog about the Dig Dug machine that I gutted and made into a MAME.
Seeing the film “The King of Kong – A fistfull of quarters” really solidified my want for a REAL Donkey Kong cabinet. One reason being that after I saw the movie I initially played on my MAME Dig Dug machine until I got to 21st place in the world back in 2008 at 184,000.   So I happen to come across the machine on craigslist. A buddy of mine found it on the Janesville, WI craigslist site and sent me the link. The guy was asking $300 for a fair quality Donkey Kong cabinet. I got him to let it go for $280. The only problem was the red color no longer output to the monitor properly.

So I got it home and powered it up, and took the geekiest picture I could think of.

 

Here are some pics showing the general state that the machine was in, bad t-molding, chips, cigarette burns, etc.

I got the machine out to my garage and got to work.  :)

Note the monitor chassis bolts.

And the blue-ness………Why Red??!?! That’s my favorite color.

The first order of business was installing the Cap kit.  A cap kit is where you desolder and resolder in new capacitors on the monitor board.  Over time the sweet goodness in the capacitors can dry out, leading to dull colors and even colors missing completely. ;)

I was really worried about stopping my heard and being unable to start it up again, so I read this site many times on the precautions and used speaker wire with a clip to ground out the NODE (cathode or anode..I’m blank right now).

Bingo, now that I’m not dead (thank you friends) here is the removed monitor board:

A shot of the 4-board version of my DK board.  This is the one where it says “Nintendo” on the main screen, not “Nintendo of America”.  So I was able to use the ladder hack and never have a barrel land on me as long as my hand was at the top of the ladder.  Unfortunately, twin galaxies does not recognize scores submitted using this board! So I need to find a 2-board version. TKG-03 is the current board.

So guess what? The cap-kit on the monitor did NOT fix my issue with the Red color not being displayed.  I found this site: http://www.brasington.org/arcade/tech/dk/ which shows screens of each chip being disabled, so you can locate your problem.  I had a bad 2J PROM chip, yaaaaay!  So what did I do? I ordered a new PROM set to replace the bad one on my 4-board version, and also ordered a 2-board version that is recognized for setting official scores.  So now I can sell my 4-board, because the 2-board is now in the cab and working great.  The 4-board is fixed too!

Look at that! I beat my previous record on an official 2-board dedicated Donkey Kong cabinet!

Now to fix up the machine.
Here’s what I ordered:
-New white t-molding all ’round
-New overlays and instructions
-New coin sticker
-New joystick repair parts
-New buttons (stupid smokers)
-New plexy with art for the control panel
-New Side-art
-Donkey Kong Blue paint bucket
-Replacement LED backlight for marquee

I started out by sanding the crap out of the machine until it was smooth, then bondo on all of the imperfections.  Most of the corners were pretty beat up so I had to use some shims and nail them in to make perfect corners.

Shot of the underside of the control panel.

Bondo…

All taped up and sanded.
I went with 3 coats of primer paint white, and 4 coats of Donkey Kong blue.  Turned out AMAZING.

Here’s after all 7 coats:

Sand blasting the coin door and repainting made all the difference.

 

I had a blast.

The back looks soo much better without the chew marks. lol

 

All in all, I had a blast on this project, and LOVE playing this machine.

Final Pics:

 

I think it looks great in my (old dining room) Arcade.  :)

Thanks for checking this out! Let me know if you have any questions.

 

-Gregg


FreePBX paging with ZAP or Dahdi

Posted: May 1st, 2012 | Author: | Filed under: Asterisk VoIP, Tech | Tags: , , , , , , , , , , , | No Comments »

This is fairly specific, but I didn’t find any posts out there to help me.
If you are using an older Freepbx with Asterisk 1.4 or 1.6 and you want to include a ZAP or DAHDI channel in a paging group, but it never rings the FXS channel, then you need to examine the dialplan.

I noticed that when it reached this point (- Executing [PAGE203@ext-paging:2] ChanIsAvail), it would hangup.
After tinkering I realized that it was checking on ZAP/4 (my channel in this case).

To fix:
-Go to the extension in Freepbx, and under the “Dial: ” options for that extension, change it from ZAP/4 to DAHDI/4.

Apply and now when you see it doing the Chanisavailable check it will pass and should call your FXS line.


Alienware 5620P Laptop

Posted: March 26th, 2011 | Author: | Filed under: Tech | Tags: , , , , , , , , , , | No Comments »

I received my first “fast” computer in 2002 as a high school graduation gift. It was amazing for about 3 years.
The Alienware Area 51-m 5620P was an amazing laptop when it came out in 2002.
-2.4GHz P4
-512MB PC2100 DDR
-40GB 5400 RPM hard drive
-Dual batteries
-ATI Mobility Radeon 7500 64MB

I could really Pwn on Counterstrike with this thing. :)
I hate to let this machine go to waste after 9 years, so I decided to bring it back to life.

Current problems:
-CMOS battery is bad as of about 5 years ago. This means every time it boots, the BIOS is reset, Date, boot settings = annoying.
-CD/DVD Drive no longer reads any media
-Battery no longer holds a charge
-512MB ram = :( …We need at least a gig now
-Power brick is melted from the sheathing wearing away. Almost started a fire.
-No wireless built-in. Definitely need a PCMCIA wireless card.

I ordered:
-Refurbished CD/DVD Drive
-New OEM Battery
-1 GB PC 2100 RAM (512×2)
-New power brick
-802.11g 54mbps PCMCIA Wireless Card

I got the memory from newegg.com for $50, and the rest on Amazon for less than $200.

CMOS BATTERY
I looked around and there aren’t any good guides to show where the CMOS battery is in this thing. I took apart the laptop about 80% of the way to figure everything out.
I had taken it apart about 5 years ago to add artic silver and reseat the heatsink.
If you turn it upside-down, you will see the four compartments. Take out the bottom right one (battery). It should slide out to reveal an adhesive cover.
Peel away the cover, and you have a neatly-wrapped CMOS battery. You can find a cheap replacement at Walgreens are almost anywhere else.

While I had it apart, I snapped a few pics to save other people time:

I should have the rest of the parts by next week. But this post wasn’t about the end-result, it was about saving other people time if they are pulling their hair out trying to locate the CMOS battery, HD, memory, or anything else.


Tomato Router Config – Backup Script

Posted: March 18th, 2011 | Author: | Filed under: Linux, Tech | Tags: , , , , , , , , , , | 2 Comments »

I recently was given the task to automate the backups of several remote routers that we manage that run tomato firmware.
Here is the Tomato developer’s site: www.polarcloud.com/tomato
The main goals were:

  • To use https
  • To be automated (Cron)’d later
  • To scale from 1 to 1XXX routers

I tested it on Tomato Firmware 1.28 using my ASUS RT-N16 router, but it should work for any Tomato-firmware router.
There will be some slight modifications to run in cron, but let me know and I’ll be glad to help.
Download the .zip file here: tomatobackup1405

Extract the file so the full path will be /root/tomatobackup1405
Read the README inside the folder
chmod +x tomatobackup1405.sh
Add your hosts to the tomatobackup1405_hosts.cfg file
Run it!

If successful, you will see a subfolder with the date YYYYMMDD and the file with CoName-tomato_v_.cfg
If there are connection problems, you’ll see an error message.

EDIT: There was a python rewrite by Sam@orgraphone.org
Feel free to check it out here

Let me know if you have any thoughts or suggestions.
-Gregg