Restarting IO-Net via application

bridged with qdn.public.ddk.network
Post Reply
Dave Edwards

Restarting IO-Net via application

Post by Dave Edwards » Thu Aug 21, 2003 3:21 pm

Hi Folks!

I have a network driver that, under certain circumstances, might want to
terminate io-net. The principle reason for this is to reload
configuration data that is stored in a config file.

(I have a separate process that checks io-net is running, if io-net
fails, then it is restarted via a shell script)

Can anyone suggest:

1. A graceful way to get io-net to shutdown from the driver
( I can just call exit, but this seems rather severe!)

2. Is there an io-net restart or shutdown devctl?


Also, I have a web server running on the system. One required feature is
to be able to reboot the unit. Currently, I cannot achieve this as
slinger is running as non root.

Is there a recommended procedure for executing system (root) level
commands via slinger?

Thanks for any suggestions

Dave

Xiaodan Tang

Re: Restarting IO-Net via application

Post by Xiaodan Tang » Thu Aug 21, 2003 4:02 pm

Dave Edwards <dave.edwards@abicom-international.com> wrote in message
news:bi2nfp$7qp$1@inn.qnx.com...
Hi Folks!

I have a network driver that, under certain circumstances, might want to
terminate io-net. The principle reason for this is to reload
configuration data that is stored in a config file.

(I have a separate process that checks io-net is running, if io-net
fails, then it is restarted via a shell script)

Can anyone suggest:

1. A graceful way to get io-net to shutdown from the driver
( I can just call exit, but this seems rather severe!)

2. Is there an io-net restart or shutdown devctl?
There isn't such devctl, but sending a SIGTERM to it, will make it goes
away gracefully.
Also, I have a web server running on the system. One required feature is
to be able to reboot the unit. Currently, I cannot achieve this as
slinger is running as non root.

Is there a recommended procedure for executing system (root) level
commands via slinger?
You can "chmod u+s /bin/shutdown", but that means any normal user
could execuate /bin/shutdown.

The (probably) more secure way, is have your own setroot utility,
it request the password of root first, only if that checked out, then it
will spawn another program as root (sort of like su, but you probably
want to gather the password from webpage, and have slinger run
your program with that password as command option).

-xtang
Thanks for any suggestions

Dave

Dave Edwards

Re: Restarting IO-Net via application

Post by Dave Edwards » Thu Aug 21, 2003 4:29 pm

xtang,

Thanks for the info. One (simple & novice ) question, is how do I send
SIGTERM?


Dave


Xiaodan Tang wrote:
Dave Edwards <dave.edwards@abicom-international.com> wrote in message
news:bi2nfp$7qp$1@inn.qnx.com...

Hi Folks!

I have a network driver that, under certain circumstances, might want to
terminate io-net. The principle reason for this is to reload
configuration data that is stored in a config file.

(I have a separate process that checks io-net is running, if io-net
fails, then it is restarted via a shell script)

Can anyone suggest:

1. A graceful way to get io-net to shutdown from the driver
( I can just call exit, but this seems rather severe!)

2. Is there an io-net restart or shutdown devctl?


There isn't such devctl, but sending a SIGTERM to it, will make it goes
away gracefully.


Also, I have a web server running on the system. One required feature is
to be able to reboot the unit. Currently, I cannot achieve this as
slinger is running as non root.

Is there a recommended procedure for executing system (root) level
commands via slinger?


You can "chmod u+s /bin/shutdown", but that means any normal user
could execuate /bin/shutdown.

The (probably) more secure way, is have your own setroot utility,
it request the password of root first, only if that checked out, then it
will spawn another program as root (sort of like su, but you probably
want to gather the password from webpage, and have slinger run
your program with that password as command option).


-xtang


Thanks for any suggestions

Dave



Xiaodan Tang

Re: Restarting IO-Net via application

Post by Xiaodan Tang » Thu Aug 21, 2003 4:41 pm

Dave Edwards <dave.edwards@abicom-international.com> wrote in message
news:bi2ret$ae7$1@inn.qnx.com...
xtang,

Thanks for the info. One (simple & novice ) question, is how do I send
SIGTERM?
kill(pid, SIGTERM)

-xtang

Dave


Xiaodan Tang wrote:

Dave Edwards <dave.edwards@abicom-international.com> wrote in message
news:bi2nfp$7qp$1@inn.qnx.com...

Hi Folks!

I have a network driver that, under certain circumstances, might want to
terminate io-net. The principle reason for this is to reload
configuration data that is stored in a config file.

(I have a separate process that checks io-net is running, if io-net
fails, then it is restarted via a shell script)

Can anyone suggest:

1. A graceful way to get io-net to shutdown from the driver
( I can just call exit, but this seems rather severe!)

2. Is there an io-net restart or shutdown devctl?


There isn't such devctl, but sending a SIGTERM to it, will make it goes
away gracefully.


Also, I have a web server running on the system. One required feature is
to be able to reboot the unit. Currently, I cannot achieve this as
slinger is running as non root.

Is there a recommended procedure for executing system (root) level
commands via slinger?


You can "chmod u+s /bin/shutdown", but that means any normal user
could execuate /bin/shutdown.

The (probably) more secure way, is have your own setroot utility,
it request the password of root first, only if that checked out, then it
will spawn another program as root (sort of like su, but you probably
want to gather the password from webpage, and have slinger run
your program with that password as command option).


-xtang


Thanks for any suggestions

Dave




Dave Edwards

Re: Restarting IO-Net via application

Post by Dave Edwards » Thu Aug 21, 2003 5:22 pm

Thanks,

Kill did the trick. I now have a nice clean shutdown!

I'll try the slinger one later

Regards

Dave


Xiaodan Tang wrote:
Dave Edwards <dave.edwards@abicom-international.com> wrote in message
news:bi2ret$ae7$1@inn.qnx.com...

xtang,

Thanks for the info. One (simple & novice ) question, is how do I send
SIGTERM?


kill(pid, SIGTERM)

-xtang


Dave


Xiaodan Tang wrote:


Dave Edwards <dave.edwards@abicom-international.com> wrote in message
news:bi2nfp$7qp$1@inn.qnx.com...


Hi Folks!

I have a network driver that, under certain circumstances, might want to
terminate io-net. The principle reason for this is to reload
configuration data that is stored in a config file.

(I have a separate process that checks io-net is running, if io-net
fails, then it is restarted via a shell script)

Can anyone suggest:

1. A graceful way to get io-net to shutdown from the driver
( I can just call exit, but this seems rather severe!)

2. Is there an io-net restart or shutdown devctl?


There isn't such devctl, but sending a SIGTERM to it, will make it goes
away gracefully.



Also, I have a web server running on the system. One required feature is
to be able to reboot the unit. Currently, I cannot achieve this as
slinger is running as non root.

Is there a recommended procedure for executing system (root) level
commands via slinger?


You can "chmod u+s /bin/shutdown", but that means any normal user
could execuate /bin/shutdown.

The (probably) more secure way, is have your own setroot utility,
it request the password of root first, only if that checked out, then it
will spawn another program as root (sort of like su, but you probably
want to gather the password from webpage, and have slinger run
your program with that password as command option).


-xtang



Thanks for any suggestions

Dave





Post Reply

Return to “qdn.public.ddk.network”