Computer Shutdown

More
29 Dec 2016 22:47 #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 or Create an account to join the conversation.

More
29 Dec 2016 23:07 #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
The following user(s) said Thank You: Moutomation

Please Log in or Create an account to join the conversation.

More
29 Dec 2016 23:19 #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 or Create an account to join the conversation.

More
24 Aug 2024 09:59 #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 or Create an account to join the conversation.

  • SamCoffee
  • SamCoffee's Avatar
  • Visitor
  • Visitor
26 Aug 2024 02:22 #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 or Create an account to join the conversation.

More
26 Aug 2024 11:33 #308691 by Moutomation
Replied by Moutomation on topic Computer Shutdown
I don't know how to do this

Please Log in or Create an account to join the conversation.

  • MennilTossFlykune
  • Offline
  • Junior Member
  • Junior Member
More
26 Aug 2024 12:30 - 27 Aug 2024 10:00 #308695 by MennilTossFlykune
Replied by MennilTossFlykune on topic Computer Shutdown
You could launch LinuxCNC with a script like so

#!/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.
Last edit: 27 Aug 2024 10:00 by MennilTossFlykune.
The following user(s) said Thank You: Aciera, Moutomation

Please Log in or Create an account to join the conversation.

More
26 Aug 2024 13:11 #308701 by Aciera
Replied by Aciera on topic Computer Shutdown
This seems to work for me:
#!/bin/bash

linuxcnc '/home/yourusername/linuxcnc/configs/yourconfig/yourconfig.ini' && systemctl poweroff
The following user(s) said Thank You: MennilTossFlykune, Moutomation

Please Log in or Create an account to join the conversation.

  • SamCoffee
  • SamCoffee's Avatar
  • Visitor
  • Visitor
28 Aug 2024 06:25 - 11 Sep 2024 06:18 #308874 by SamCoffee
Replied by SamCoffee on topic Computer Shutdown
how is it going?
Last edit: 11 Sep 2024 06:18 by SamCoffee.

Please Log in or Create an account to join the conversation.

More
28 Aug 2024 06:36 - 28 Aug 2024 06:49 #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
Last edit: 28 Aug 2024 06:49 by Aciera.

Please Log in or Create an account to join the conversation.

Time to create page: 0.073 seconds
Powered by Kunena Forum