×

INDI Library v1.9.6 Released (21 May 2022)

Bi-monthly INDI Library released with new drivers and bug fixes.

How to shut down a Pi from EKOS

  • Posts: 43
  • Thank you received: 2
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
1 year 2 weeks ago #72401

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

  • Posts: 1067
  • Thank you received: 137
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: 1 year 2 weeks ago by AstroNerd.
1 year 2 weeks ago #72403

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

  • Posts: 1067
  • Thank you received: 137
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: 1 year 2 weeks ago by AstroNerd.
1 year 2 weeks ago #72404

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

  • Posts: 43
  • Thank you received: 2
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
1 year 2 weeks ago #72405

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

  • Posts: 1067
  • Thank you received: 137
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: 1 year 2 weeks ago by AstroNerd.
1 year 2 weeks ago #72410

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

  • Posts: 43
  • Thank you received: 2
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: 1 year 2 weeks ago by James Seaman.
1 year 2 weeks ago #72413

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

  • Posts: 126
  • Thank you received: 14
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 w/Stellarmate out on the scope, Raspberry Pi 4B 4GB test server
Linux client
1 year 2 weeks ago #72421

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

  • Posts: 43
  • Thank you received: 2
Thanks Dave, already tried that (but did it again), no joy I'm afraid
1 year 2 weeks ago #72423

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

  • Posts: 1067
  • Thank you received: 137
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: 1 year 2 weeks ago by AstroNerd.
1 year 2 weeks ago #72424

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

  • Posts: 43
  • Thank you received: 2
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?
1 year 2 weeks ago #72425

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

  • Posts: 1067
  • Thank you received: 137
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: 1 year 2 weeks ago by AstroNerd.
1 year 2 weeks ago #72427

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

  • Posts: 43
  • Thank you received: 2
:) 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
1 year 2 weeks ago #72429
Attachments:

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

Time to create page: 0.881 seconds