non-interactive Shutdown in photon !

Hi all,

Situation:

We often work on project that use QNX 6.3 with full Photon environnement on
regular PC. Most of time, we use a UPS that we control via an some I/O that we
have on a custom PCI card. We can send a bit to the UPS to cut power on the
whole system (with a hardware timer in it to let enought time to
do a clean shutdown on the computers). During that “grace” time, I want to do
a clean shutdown to the computer from our Photon Application directly or by
spawning a shell command.

Question:

Is there a way to do a proper shutdown (not reboot) in QNX (running photon)
from my application or by a shell command with no interaction needed by
the user.

I try many possibilities and nothing work properly…


/bin/shutdown utility don’t work well under photon, the image on the screen
freeze and the computer seems to be crashed. (it’s look stupid to ship it like
this to the client).


phshutdown utility don’t seems to work without user interaction to click the
shutdown type and confirm… Even if I specify the shutdown type as parameters
like the following:

/usr/photon/bin/phshutdown -S system

It still pop-up the little dialog and need user interaction. Is there a bug in
phshutdown ? Why it’s ignore any parameters I give to it.


Is There a clean solution to do what I want…

Thank you very much

Martin Gagnon

Martin Gagnon schrieb:

Hi all,

Situation:

We often work on project that use QNX 6.3 with full Photon environnement on
regular PC. Most of time, we use a UPS that we control via an some I/O that we
have on a custom PCI card. We can send a bit to the UPS to cut power on the
whole system (with a hardware timer in it to let enought time to
do a clean shutdown on the computers). During that “grace” time, I want to do
a clean shutdown to the computer from our Photon Application directly or by
spawning a shell command.

Question:

Is there a way to do a proper shutdown (not reboot) in QNX (running photon)
from my application or by a shell command with no interaction needed by
the user.

I try many possibilities and nothing work properly…


/bin/shutdown utility don’t work well under photon, the image on the screen
freeze and the computer seems to be crashed. (it’s look stupid to ship it like
this to the client).


phshutdown utility don’t seems to work without user interaction to click the
shutdown type and confirm… Even if I specify the shutdown type as parameters
like the following:

/usr/photon/bin/phshutdown -S system

It still pop-up the little dialog and need user interaction. Is there a bug in
phshutdown ? Why it’s ignore any parameters I give to it.


Is There a clean solution to do what I want…

Thank you very much

Martin Gagnon
please look in <sys/shutdown.h

/*** API ***/

extern void shutdown(int type,int flags);




\


Joerg Hering
Chief Developer VDR
e-mail: jhering@avecs-bergen.de GPG Key-ID:0x71DDB82F
mobile: jhering.ruegen@gmx.de GPG Key-ID:0x7F25BEF1

AVECS Bergen GmbH
development department
Billrothstraße 11a
D-18528 Bergen auf Rügen

Tel.: +49 3838 2119101
Fax: +49 3838 2119105
Mobile: +49 172 3896974
Skype: j.hering
URL: http://www.avecs-bergen.de


On 2006-03-18, Jörg Hering <jhering.ruegen@gmx.de> wrote:

please look in <sys/shutdown.h

/*** API ***/

extern void shutdown(int type,int flags);

It’s do exactly the same thing as the shell command of the same name
(/bin/shutdown). The computer seems to be frozen after the shutdown,
there’s absolutely no feedback to tell me if the shutdown is finish and
successfull …

Martin

Martin Gagnon wrote:

On 2006-03-18, Jörg Hering <> jhering.ruegen@gmx.de> > wrote:

please look in <sys/shutdown.h

/*** API ***/

extern void shutdown(int type,int flags);





It’s do exactly the same thing as the shell command of the same name
(/bin/shutdown). The computer seems to be frozen after the shutdown,
there’s absolutely no feedback to tell me if the shutdown is finish and
successfull …

What do you expecting after shuting down the operating system ???

–Armin


Martin

On 2006-03-19, Armin Steinhoff <a-steinhoff@web.de> wrote:

Martin Gagnon wrote:
On 2006-03-18, Jörg Hering <> jhering.ruegen@gmx.de> > wrote:

please look in <sys/shutdown.h

/*** API ***/

extern void shutdown(int type,int flags);





It’s do exactly the same thing as the shell command of the same name
(/bin/shutdown). The computer seems to be frozen after the shutdown,
there’s absolutely no feedback to tell me if the shutdown is finish and
successfull …

What do you expecting after shuting down the operating system ???

I don’t know… A message in the screen like the /bin/shutdown does in
console mode, or a complete blank screen when the shutdown is finish is
ok for me…

Martin

Shutdown is for wusses. If it can’t handle lose of power as a normal event then it needs redesigned.


Evan

Evan Hillas wrote:

Shutdown is for wusses. If it can’t handle lose of power as a normal
event then it needs redesigned.

Well … Python e.g. comes with batteries included … why not QNX ??

–Armin

Armin Steinhoff wrote:

Evan Hillas wrote:

Shutdown is for wusses. If it can’t handle lose of power as a normal
event then it needs redesigned.


Well … Python e.g. comes with batteries included … why not QNX ??

Now just need to make it so they don’t go flat when not in use.


Evan

On 2006-03-19, Evan Hillas <evanh@clear.net.nz> wrote:

Shutdown is for wusses. If it can’t handle lose of power as a normal event then it needs redesigned.

I’ve never talk about lost of power… I know when the power will be
cut and I have a lot of time to close everything and make a shutdown.

We already have a big structures with a lot computers, PLC’s,
electronics etc., the UPS is there to protect against bit power glitches
because our system work on a hostile industrial environnement.

Sometimes, the operator want to shutdown the system by pressing a kind
of big “mushroom” button and I receive an I/O signal (application in the
QNX computer), when that’s happens, I want shutdown the computer, that’s
all. Is it rocket science ?

I just want a kind of *feed back" when the computer is really shutdown
like it’s do with phshutdown (but have to be interactive) or like
/bin/shutdown or the shutdown command from the library when running from
the console.

Martin

Why don’t you just put up your own shutdown screen and spawn off the shutdown command behind the scenes?
Or slay the photon session off to exit back to text mode?

Martin Gagnon wrote:

On 2006-03-19, Evan Hillas <> evanh@clear.net.nz> > wrote:

Shutdown is for wusses. If it can’t handle lose of power as a normal event then it needs redesigned.



I’ve never talk about lost of power… I know when the power will be
cut and I have a lot of time to close everything and make a shutdown.

We already have a big structures with a lot computers, PLC’s,
electronics etc., the UPS is there to protect against bit power glitches
because our system work on a hostile industrial environnement.

Sometimes, the operator want to shutdown the system by pressing a kind
of big “mushroom” button and I receive an I/O signal (application in the
QNX computer), when that’s happens, I want shutdown the computer, that’s
all. Is it rocket science ?

I just want a kind of *feed back" when the computer is really shutdown
like it’s do with phshutdown (but have to be interactive) or like
/bin/shutdown or the shutdown command from the library when running from
the console.

Martin

On 2006-03-20, Colin Burgess <cburgess@qnx.com> wrote:

Why don’t you just put up your own shutdown screen and spawn off the shutdown command behind the scenes?

It’s just mask the problem… it’s always look to work… but if something
goes wrong during the shutdown…

Or slay the photon session off to exit back to text mode?

My program run in photon…, it will be terminate during I slay photon…,
it will no be able to call shutdown…

Martin.

AFAIK phshutdown simply goes about and slays off processes and then calls shutdown() to shutdown the system.
You should be able to emulate it just fine with your system, I presume you know exactly what servers you need
to shutdown to ensure a clean reboot?

At the end, if things went fine, just call shutdown() to restart the system.

Martin Gagnon wrote:

On 2006-03-20, Colin Burgess <> cburgess@qnx.com> > wrote:

Why don’t you just put up your own shutdown screen and spawn off the shutdown command behind the scenes?


It’s just mask the problem… it’s always look to work… but if something
goes wrong during the shutdown…


Or slay the photon session off to exit back to text mode?



My program run in photon…, it will be terminate during I slay photon…,
it will no be able to call shutdown…

Martin.

Hello Martin …

On Mon, 20 Mar 2006 17:50:03 +0000, Martin Gagnon wrote:

My program run in photon…, it will be terminate during I slay photon…,
it will no be able to call shutdown…

Here’s what we do to ‘shutdown’ our systems:

Theshutdown procedure of ‘process manager’ terminates all
processes it has started before, specially the database.
Then it slays all known system processes, that may directly or
indirectly affect the disk (inetd, syslogd, cron, etc.)

Finally it issues some sync’s an then it pops up the final
‘Your system can now be switched off …’ or it issues the
original /bin/shutdown to reboot.

That works quite well for us :slight_smile:

HTH,

Karsten.


Karsten P. Hoffmann MBS GmbH