Delay using EXEC_ONCE

Posted by: cushman

Delay using EXEC_ONCE - 09/03/2003 19:45

I just thought that I would ask what the best way to do this is.

I have a need to execute a program AFTER the player is started. It seems that if you use the irattach binary to start up the IrDA stack BEFORE the player app starts, something in the player app interferes with the IrDA stack, and IrDA is flaky.

I have a shell script called start_empire that contains the following:

#!/bin/bash
echo "start_empire: sleeping for $1 seconds..."
/usr/local/bin/sleep $1
echo "start_empire: Starting Empire..."
/usr/local/bin/irattach /dev/ttyS2
/usr/local/bin/empire

I added a line in my config.ini that reads:
;@EXEC_ONCE /bin/bash -c "/usr/local/bin/start_empire 7 &"

This does the job. It seems like 7 seconds is the sweet spot (on my player) where it will wait from the EXEC_ONCE line to after the player has started. The timing has to be configurable by modifying a variable in config.ini, since it will be different on other players.

Is there a better/cleaner way to do this, or is the shell script the best way to get this done? Would a better way be to modify empire.c so it does the irattach only after waiting for X seconds?
Posted by: tman

Re: Delay using EXEC_ONCE - 09/03/2003 20:50

You could probably ask Mark Lord very nicely to make a new EXEC_AFTER_PLAYER or something since Hijack already watches for when the player has started to do other things. e.g. Restoring visuals when in car mode.

- Trevor
Posted by: cushman

Re: Delay using EXEC_ONCE - 09/03/2003 21:31

How about it, Mark? Pretty please with Camalots on top!
Posted by: revlmwest

Re: Delay using EXEC_ONCE - 10/03/2003 06:20

Leave the Camelites out of this...
Posted by: mlord

Re: Delay using EXEC_ONCE - 10/03/2003 16:36

Mmm.. but I already have two stacked racks of camalots!

Posted by: cushman

Re: Delay using EXEC_ONCE - 10/03/2003 17:06

Well then I guess there's no bribing you.

Do you aid climb? I have 7 Camalots and 4 TCU's and they have done the trick for me at the Red, the New, Seneca, Boulder, etc.
Posted by: Ezekiel

Re: Delay using EXEC_ONCE - 10/03/2003 18:46

What about Camel Regulars? Maybe some American Spirits (or Export A Lites for our northern brothers)?

-Z