Skip to content

Commit

Permalink
final fix for sudo path on reboot and shutdown #62
Browse files Browse the repository at this point in the history
  • Loading branch information
hcwinsemius committed Apr 8, 2024
1 parent db480d4 commit bfd93cb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion nodeorc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""NodeORC: Automated edge and cloud image-based discharge estimation with OpenRiverCam"""
import os
__version__ = "0.1.3"
__version__ = "0.1.4"

__home__ = os.path.join(os.path.expanduser("~"), ".nodeorc")
if not(os.path.isdir(__home__)):
Expand Down
3 changes: 2 additions & 1 deletion nodeorc/tasks/local_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ def _shutdown_or_not(self):
if self.settings["shutdown_after_task"]:
self.logger.info("Task done! Shutting down...")
os.system("/sbin/shutdown -h now")
os.system("sudo /sbin/shutdown -h now")
os.system("/bin/sudo /sbin/shutdown -h now")
os.system("/usr/bin/sudo /sbin/shutdown -h now")

def _post_callbacks(self, callbacks):
"""
Expand Down
4 changes: 3 additions & 1 deletion nodeorc/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def get_bucket(
else:
return None


def upload_io(obj, bucket, dest=None, logger=logging):
"""
Uploads BytesIO obj representation of data in file 'fn' in bucket
Expand Down Expand Up @@ -102,4 +103,5 @@ def is_file_size_changing(fn, delay=1):
def reboot_now():
os.system("/sbin/shutdown -r now")
# in case this fails, do a sudo shutdown
os.system("sudo /sbin/shutdown -r now")
os.system("/bin/sudo /sbin/shutdown -r now")
os.system("/usr/bin/sudo /sbin/shutdown -r now")

0 comments on commit bfd93cb

Please sign in to comment.