×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

How to shut down a Pi from EKOS

  • Posts: 44
  • 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
2 years 10 months ago #72401

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

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

i think you have to use sudo….
Last edit: 2 years 10 months ago by AstroNerd.
2 years 10 months ago #72403

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

  • Posts: 1067
  • Thank you received: 140
Also try this in your script
sudo shutdown -h now
Last edit: 2 years 10 months ago by AstroNerd.
2 years 10 months ago #72404

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

  • Posts: 44
  • 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
2 years 10 months ago #72405

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

  • Posts: 1067
  • Thank you received: 140
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….
Last edit: 2 years 10 months ago by AstroNerd.
2 years 10 months ago #72410

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

  • Posts: 44
  • 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: 2 years 10 months ago by James Seaman.
2 years 10 months ago #72413

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

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

sudo systemctl poweroff
exit(0)

Thanks,
Dave
2 years 10 months ago #72421

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

  • Posts: 44
  • Thank you received: 2
Thanks Dave, already tried that (but did it again), no joy I'm afraid
2 years 10 months ago #72423

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

  • Posts: 1067
  • Thank you received: 140
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…. :)
Last edit: 2 years 10 months ago by AstroNerd.
2 years 10 months ago #72424

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

  • Posts: 44
  • 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?
2 years 10 months ago #72425

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

  • Posts: 1067
  • Thank you received: 140
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…. :)
Last edit: 2 years 10 months ago by AstroNerd.
2 years 10 months ago #72427

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

  • Posts: 44
  • 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
2 years 10 months ago #72429
Attachments:

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

Time to create page: 0.859 seconds