shutdown questions

I would like to do some cleaning up before QNX shuts itself down, to clean
out some directories and shutdown some processes. Is there anyway I can set
up a script to be executed at shutdown or do I have to create a program that
is loaded and then waits for the appropriate signals to perform the desired
actions? If I do indeed have to create the program does any one have some
suggestions about how to do this, I have never done any signal processing.
Thanks in advance.

Ross

ps. by shutdown i am talking about when the computer is told to power down,
via the shutdown command.

Previously, Ross Brantner wrote in qdn.public.qnx4:

I don’t think a script could wait for and catch a signal.
You could create a very small program that does this, and
then runs a script using the system() call.

As far as catching a signal, the code could look something like
this:

void MyHandler (int sig_number)
{
system(“sh my_script”);
exit(0);
}

main()
{
signal(SIGPWR,MyHandler);
Receive(0,NULL,NULL);
}



I would like to do some cleaning up before QNX shuts itself down, to clean
out some directories and shutdown some processes. Is there anyway I can set
up a script to be executed at shutdown or do I have to create a program that
is loaded and then waits for the appropriate signals to perform the desired
actions? If I do indeed have to create the program does any one have some
suggestions about how to do this, I have never done any signal processing.
Thanks in advance.

Ross

ps. by shutdown i am talking about when the computer is told to power down,
via the shutdown command.
\


Mitchell Schoenbrun --------- maschoen@pobox.com

I know this isn’t the Photon group but it is a relate query, when using
“phshutdown”, are there any signals sent that can be used to ensure a clean
shutdown? SIGPWR works well using “shutdown” but I would also like to have
a method to use when shuttingdown from Photon. Any ideas? Thanks.

Ross

“Mitchell Schoenbrun” <maschoen@pobox.com> wrote in message
news:Voyager.020121100324.249C@schoenbrun.com

Previously, Ross Brantner wrote in qdn.public.qnx4:

I don’t think a script could wait for and catch a signal.
You could create a very small program that does this, and
then runs a script using the system() call.

As far as catching a signal, the code could look something like
this:

void MyHandler (int sig_number)
{
system(“sh my_script”);
exit(0);
}

main()
{
signal(SIGPWR,MyHandler);
Receive(0,NULL,NULL);
}



I would like to do some cleaning up before QNX shuts itself down, to
clean
out some directories and shutdown some processes. Is there anyway I can
set
up a script to be executed at shutdown or do I have to create a program
that
is loaded and then waits for the appropriate signals to perform the
desired
actions? If I do indeed have to create the program does any one have
some
suggestions about how to do this, I have never done any signal
processing.
Thanks in advance.

Ross

ps. by shutdown i am talking about when the computer is told to power
down,
via the shutdown command.



\

Mitchell Schoenbrun --------- > maschoen@pobox.com

Hi Ross,

I posted the response to qdn.public.qnx4.photon. Please try not to
cross post.

Thanks
Brenda

Ross Brantner wrote:

I know this isn’t the Photon group but it is a relate query, when using
“phshutdown”, are there any signals sent that can be used to ensure a clean
shutdown? SIGPWR works well using “shutdown” but I would also like to have
a method to use when shuttingdown from Photon. Any ideas? Thanks.

Ross

“Mitchell Schoenbrun” <> maschoen@pobox.com> > wrote in message
news:> Voyager.020121100324.249C@schoenbrun.com> …

Previously, Ross Brantner wrote in qdn.public.qnx4:

I don’t think a script could wait for and catch a signal.
You could create a very small program that does this, and
then runs a script using the system() call.

As far as catching a signal, the code could look something like
this:

void MyHandler (int sig_number)
{
system(“sh my_script”);
exit(0);
}

main()
{
signal(SIGPWR,MyHandler);
Receive(0,NULL,NULL);
}




I would like to do some cleaning up before QNX shuts itself down, to

clean

out some directories and shutdown some processes. Is there anyway I can

set

up a script to be executed at shutdown or do I have to create a program

that

is loaded and then waits for the appropriate signals to perform the

desired

actions? If I do indeed have to create the program does any one have

some

suggestions about how to do this, I have never done any signal

processing.

Thanks in advance.

Ross

ps. by shutdown i am talking about when the computer is told to power

down,

via the shutdown command.



\

Mitchell Schoenbrun --------- > maschoen@pobox.com


\