Shutdown ATX problem

I have an ATX motherboard that I want to set the power supply on button to
turn the whole computer on without having to hit the “start” button. This
works fine. The problem I’m having is with the bios setting set to allow
this, shutdowns from terminals don’t work. I can still shutdown the system
from the menu command, just not from a terminal. I need to be able to use
the shutdown command in a c program to turn off the machine but currently
the system hangs with a black screen or logon screen with a frozen mouse
cursor after I type in “shutdown”.

Any ideas as to what I need to do from the command line/c program to
shutdown the system the same way it does in the menu?

Thanks,

Jim