Can Pegasus be shutdown with a script?

  • Last Post 29 June 2018
David Brown posted this 25 June 2018

Is it possible to shutdown a Pegasus 2 via a script? I do not see a shutdown command in the promiseutil command line tool. But I'm hopefull there is a solution.

Promise Utility Version 4.02, iMac Pro, 10 core, 64GB RAM, 1TB SSD, Raedon Pro Vega 64 16GB, macOS 10.13.5 (17F77)

Order By: Standard | Latest | Votes
Raghuraman Kannan posted this 25 June 2018

Hi David,

Pegasus units can be shutdown via the command line interface.

You can use the following commands 

shutdown -a shutdown (To shutdown the Subsystem)

shutdown -a restart (To restart the Subsystem)

Thanks !

R P posted this 25 June 2018

Hi David,

Scripting this is pretty easy, I've not tested this script, but short of a typo this should be good.




## This script shuts doiwn the first Pegasus

## 2018-06-25


SHUTDOWN=$(/usr/bin/promiseutil -C "shutdown -a shutdown")

if (( SHUTDOWN == 0 ))


  echo "The Pegasus has been successfully shut down"



Just save it to a file named shutdown.bash, then give it execute permissions with 'chmod +x shutdown.bash'.

You can use cron to arrange when the script is run. Here's a blog about setting up a crontab.

Note that there are special considerations for writting cronnable scripts, the script above should be cronnable.

It also appears that Apple has written an app for that named 'automator'.


David Brown posted this 26 June 2018

Thank you for your reply. I have not had success, unfortunately. I simplified the script to one line: /usr/local/bin/promiseutil -C "about", but it does not execute. It does not execute regardless of the command used, i.e. about, shutdown, etc. When I put the command in macOS Terminal, it executes normally.

By the way, promiseutil is located in usr/local/bin, not usr/bin. I've been searching for solutions online; one person stated that in order to execute prcesses in usr/local/bin, you must first cd into that directory. Unfortunately, that did not fix the issue.

Please let me know if you have any ideas. I appreciate your help.

R P posted this 26 June 2018

If you remove the shell line you no longer have an executable file.

You need to add back the first line. 



/usr/local/bin/promiseutil -C "about"


The only other way to run the the script is to call it with the shell. If you named your file 'shutdown' then you could use 'bash ./shutdown'. Punctuation is important in scripts, and bash is sensitive to spaces, somethines spaces are required and sometimes spaces are forbidden (it's a legacy thing), so you need to copy the code exactly unless you know the rules.

Interestingly, I took these lines from a working script I had previously written years ago, looks like they moved where things get installed, not a problem as such, next script I write I will add some logic to find the appropriate path.

David Brown posted this 27 June 2018

I must appologize for not being clear - when I previousley wrote "I simpliffed the script to one line...", I was not counting the shell line. I am at a loss as to why I can not get his to work. I am calling the script from an AppleScript using the 'do shell scrpt' command, so perhaps that is a factor. I developed a workaround wherein I send the promiseutil command to macOS Terminal, where it executes fine. It's not an elegant solution, although it's effective, which bugs me.

I'm going to keep working to get the command working from the script. If you have any other ideas, please let me know. If I do find the cause of hte problem I am having, I'll let you know.

Thank you for your help - it is appreciated.

R P posted this 27 June 2018

Hi David,

I am not all that familiar with the applescript enviornment, but it's possible that you need to use 'sudo'.

Other than that some debugging might be in order, I would write a shell that generates debugging output and saves it to a file.

Something like this should do the trick. The -x flag gives debug output. This saves both stdout and stderr to the file.


/bin/bash -x /path/to/shutdown.bash >& ~/script_debug.txt

Call this with applescript and check the output file in your home directory for clues.

David Brown posted this 28 June 2018

Thanks for the tip. I tried it, but the output from running the scrip with -x was only one line, containing the path to the script.

When I run the script in macOS Terminal, it runs fine. When I run it from AppleScript or the Script Menu in Finder, it does not run. That fact probably tells us something, but I don't yet know what!

I'll keep you posted if I figure it out. Thanks again.

R P posted this 28 June 2018

When I run it from AppleScript or the Script Menu in Finder, it does not run.

Can you post your applescript code that calls the shell script?

David Brown posted this 28 June 2018

I have attached both the scrip I'm using for testing (, and the AppleScript I'm using to call the script (Callpromiseutilscript.scpt). The script has two commands, one to diskutil in order to verify that the script ran, and one to promiseutil.

There are three commands in the AppleScript. The first calls the, with administrator privileges for good measure. The command produces the correct output for diskutil, but not promiseutil.

The next two commands tests direclty calling the commands used in the script. Again, the diskutil version works, the promiseutil version does not.

Edit: I'm not sure if the files were uploaded. Here they are:


diskutil list > /Users/David/Desktop/diskutiloutput.txt

/usr/local/bin/promiseutil -C 'about' > /Users/David/Desktop/promiseutiloutput.txt


do shell script "bash /Users/David/Library/Scripts/Applications/Finder/" password "XXX" with administrator privileges

do shell script "diskutil list > /Users/David/Desktop/diskutiloutput2.txt" password "XXX" with administrator privileges


do shell script "/usr/local/bin/promiseutil -C 'about' > /Users/David/Desktop/promiseutiloutput2.txt" password "XXX" with administrator privileges

R P posted this 29 June 2018

Hi David,

I just added a Pegasus 2 to my MACbook and tried to run promiseutil in applescript, and it won't run even in the editor. So I wrote a bash script (which runs fine) and ran it from applescript, I get an error for a non-zero exit code, so I added an 'exit 0' to the script and now it runs but there is no output.

At this point, my best guess is that this is a library path issue, as applescript does not carry the shell enviornment along with it, if promiseutil has some additional libraries, they cannot be seen in appletalk. But I'm not having much luck tracing system calls with dtruss for some reason.

I developed a workaround wherein I send the promiseutil command to macOS Terminal, where it executes fine. It's not an elegant solution, although it's effective, which bugs me.

I think this by itself proves that it's an enviornmental issue, when you send it to terminal, you get the full shell enviornment.

So the applescript solution will require adding the missing enviornment to the promiseutil call, but High Sierra shows nothing for $LD_LIBRARY_PATH or $DYLD_LIBRARY_PATH, I'm going to have to do some more research on this, they've hidden a lot of stuff.

But a simpler approach might be to use cron to run the shellscript. But this may run into the same problem as cron jobs also lack an enviornment, and we don't know what enviornment promiseutil needs in order to run.

I will keep looking into it time allowing.