×

INDI Library v1.9.2 Released (14 Sep 2021)

Bimonthly Stable INDI Library release introduces new drivers and fixes for existing ones.

How to shut down a Pi from EKOS

  • Posts: 24
  • Thank you received: 0
Hi all,

I'm new to the pi and ekos but it seems to be going very well so far. I'm just setting up my first scheduler and I'd like to shut the pi down at the end of it. I am assuming I should use the shutdown script but I haven't been able to make it work. I have tried using various commands ("systemctl poweroff" "shutdown now", "sudo shutdown now") including the script below but nothing seems to work:

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import sys
import os
os.system('python maxclose.py')
exit(0)

James
3 months 16 hours ago #72401

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

  • Posts: 1061
  • Thank you received: 132
Have you tried 
#!/bin/bash
sudo systemctl poweroff

i think you have to use sudo….
Stellarmate OS on Raspberry pi4b
Skywatcher EQ8 pro, on steel pier
Takahashi FSQ85, FS60cb & Meade 8” SCT (de-forked)
Starlight Xpress SXVR H18, SXVR M25c, Lodestar x2 Guide Camera
Pegasus Ultimate Hub V2 for all USB & Power
Pegasus focus motors on all scopes
Last edit: 2 months 4 weeks ago by AstroNerd.
3 months 13 hours ago #72403

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

  • Posts: 1061
  • Thank you received: 132
Also try this in your script
sudo shutdown -h now
Stellarmate OS on Raspberry pi4b
Skywatcher EQ8 pro, on steel pier
Takahashi FSQ85, FS60cb & Meade 8” SCT (de-forked)
Starlight Xpress SXVR H18, SXVR M25c, Lodestar x2 Guide Camera
Pegasus Ultimate Hub V2 for all USB & Power
Pegasus focus motors on all scopes
Last edit: 2 months 4 weeks ago by AstroNerd.
3 months 13 hours ago #72404

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

  • Posts: 24
  • Thank you received: 0
Hi, thanks for the replies - I tried both and they are exactly the same

Is the script file just a plaintext file? Does it care about any headers or file extensions or should it literally just contain that one line? It says it's running the shutdown process but I don't know if it is
3 months 12 hours ago #72405

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

  • Posts: 1061
  • Thank you received: 132
I assume you have made the script executable..??
can to paste and expect copy of your script you are using…and you only need to put the exact path to it in ekos scheduler….
Stellarmate OS on Raspberry pi4b
Skywatcher EQ8 pro, on steel pier
Takahashi FSQ85, FS60cb & Meade 8” SCT (de-forked)
Starlight Xpress SXVR H18, SXVR M25c, Lodestar x2 Guide Camera
Pegasus Ultimate Hub V2 for all USB & Power
Pegasus focus motors on all scopes
Last edit: 3 months 11 hours ago by AstroNerd.
3 months 11 hours ago #72410

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

  • Posts: 24
  • Thank you received: 0
Hi, yes I right clicked and said anyone can execute it

If I use the following two lines:
systemctl poweroff
exit (0)

Then I can run it in terminal and it works but ekos doesn't
Last edit: 3 months 8 hours ago by James Seaman.
3 months 8 hours ago #72413

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

  • Posts: 97
  • Thank you received: 12
If you are already root, it will run for you and not for Ekos. Try this:

sudo systemctl poweroff
exit(0)

Thanks,
Dave
Dave Allmon

Meade 12" LX600, William Optics GT81 IV, Stellarvue F080M3 (guidescope)
SBIG STF-8300EN, ASI 290mm mini (guide camera)
Raspberry Pi 4B 8GB Indi server, Raspberry Pi 4B 4GB test server
Linux client
3 months 6 hours ago #72421

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

  • Posts: 24
  • Thank you received: 0
Thanks Dave, already tried that (but did it again), no joy I'm afraid
3 months 5 hours ago #72423

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

  • Posts: 1061
  • Thank you received: 132
I’m not sure you are understanding the way a script runs, it’s not just a case of right clicking and giving permissions, you have to create the bash script, then make it executable, clicking and saying anyone can execute, IS NOT making it executable,  it’s different, from just entering a command in the terminal, that’s easy, I can type “sudo poweroff” and it shuts mine down, I can type “ sudo reboot” and it reboots my system straight away, but this is not a script…
I am not meaning to be patronising, sorry if it seems that way and am trying to help…. :)
Stellarmate OS on Raspberry pi4b
Skywatcher EQ8 pro, on steel pier
Takahashi FSQ85, FS60cb & Meade 8” SCT (de-forked)
Starlight Xpress SXVR H18, SXVR M25c, Lodestar x2 Guide Camera
Pegasus Ultimate Hub V2 for all USB & Power
Pegasus focus motors on all scopes
Last edit: 3 months 5 hours ago by AstroNerd.
3 months 5 hours ago #72424

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

  • Posts: 24
  • Thank you received: 0
Hi I am not taking it as patronising but I'm not sure what you mean either

Creating the script is just right click on the desktop and new file with a .sh extension isn't it?

After that I right click the file, choose properties and set execute to anyone, is this not correct? It seems to have the same effect as the command chmod a+x to give execute permissions

What am I missing?
3 months 5 hours ago #72425

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

  • Posts: 1061
  • Thank you received: 132
Yes, then you save the script to a location, then in ekos you put the full path to the script in the scheduler box…and it will execute it…. :)
Stellarmate OS on Raspberry pi4b
Skywatcher EQ8 pro, on steel pier
Takahashi FSQ85, FS60cb & Meade 8” SCT (de-forked)
Starlight Xpress SXVR H18, SXVR M25c, Lodestar x2 Guide Camera
Pegasus Ultimate Hub V2 for all USB & Power
Pegasus focus motors on all scopes
Last edit: 3 months 5 hours ago by AstroNerd.
3 months 5 hours ago #72427

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

  • Posts: 24
  • Thank you received: 0
:) Yep definitely doing that, it says it is running but doesn't:

 
 

I'm pretty sure I'm doing what is asked but open to having missed something
3 months 5 hours ago #72429
Attachments:

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

Time to create page: 1.251 seconds