Computer Shutdown

More
9 years 10 months ago #84883 by babinda01
Computer Shutdown was created by babinda01
Hello
I am just commencing a retrofit of a milling machine. I am trying to decide on a UI to use - at the moment I am tossing up between Gmoccapy and a custom GScreen.
My first question......is there a way to shut down the pc when you exit Linuxcnc. For example, if I am using Gmoccapy, and I click the exit button in the lower right corner, it would be great if it could shut down Linuxcnc and then shut down the PC.

Thanks
Andrew

Please Log in to join the conversation.

More
9 years 10 months ago #84885 by newbynobi
Replied by newbynobi on topic Computer Shutdown
I can imagine two solutions

1. Change gmoccapy code to execute the shutdown command.
2. Use a bash script to start ljnuxcnc and wait until linuxcnc stops and send then the shutdown command.

But i have never done that.

Norbert

Please Log in to join the conversation.

More
9 years 10 months ago #84886 by babinda01
Replied by babinda01 on topic Computer Shutdown
Hi Norbert

Thanks - I will try the bash script first, as I am a little more comfortable doing that.

Andrew

Please Log in to join the conversation.

More
2 years 2 months ago #308526 by Moutomation
Replied by Moutomation on topic Computer Shutdown
Hello,
I use gmoccapy. When I turn on the machine, the computer starts first, then gmoccapy. How can I shut down Linuxcnc first and then the computer when I press an external key?
Can I do this with a button on the machine?

Please Log in to join the conversation.

  • SamCoffee
  • New Member
  • New Member
More
2 years 2 months ago #308637 by SamCoffee
Replied by SamCoffee on topic Computer Shutdown

Hello,
I use gmoccapy. When I turn on the machine, the computer starts first, then gmoccapy. How can I shut down Linuxcnc first and then the computer when I press an external key?
Can I do this with a button on the machine?
 
Hello,

I think you could script the HAL file to configure the external button to shut down LinuxCNC first, then the computer, and link the button to both functions in that order.

 

Please Log in to join the conversation.

More
2 years 2 months ago #308691 by Moutomation
Replied by Moutomation on topic Computer Shutdown
I don't know how to do this

Please Log in to join the conversation.

More
2 years 2 months ago #308695 by MennilTossFlykune
Replied by MennilTossFlykune on topic Computer Shutdown
You could launch LinuxCNC with a script like so

Code:
#!/bin/bash linuxcnc '/home/yourusername/linuxcnc/configs/yourconfig/yourconfig.ini' systemctl poweroff

and connect the pin gmoccapy.h-button.button-9, which exits gmoccapy, to an external button.

Please Log in to join the conversation.

More
2 years 2 months ago #308701 by Aciera
Replied by Aciera on topic Computer Shutdown
This seems to work for me:
Code:
#!/bin/bash linuxcnc '/home/yourusername/linuxcnc/configs/yourconfig/yourconfig.ini' && systemctl poweroff

Please Log in to join the conversation.

  • SamCoffee
  • New Member
  • New Member
More
2 years 2 months ago #308874 by SamCoffee
Replied by SamCoffee on topic Computer Shutdown
how is it going?

Please Log in to join the conversation.

More
2 years 2 months ago #308876 by Aciera
Replied by Aciera on topic Computer Shutdown
Are you asking me how it works or are you asking the OP if it works for him?

[edit]

'&&' means that the second command (ie 'systemctl poweroff') is only executed once the first command (ie 'linuxcnc '/home/yourusername/linuxcnc/configs/yourconfig/yourconfig.ini') has been successfully executed, which is only the case once linuxcnc has been shutdown again.

Useful if you want a one line command.

[edit2]
in comparison '&' will run both commands independently

Please Log in to join the conversation.

Time to create page: 0.115 seconds
Powered by Kunena Forum