Category filter

Frequently Asked Questions on macOS shell scripting

Why is the script not running on a macOS device?

Before assigning the shell scripts to macOS devices, make sure that the following criteria are met.

  • Verify that the Hexnode MDM server is able to reach the device. Additionally, the Hexnode MDM agent installed on the device should be running its latest app version.
  • Re-instate device activity. When the device is not network-connected or inactive, the Hexnode MDM agent app will be unable to receive the scripts pushed from the portal.
  • Necessarily, a shell script begins with ‘#!’. Also, the script should be in a valid location like #!/bin/sh or #!/usr/bin/env zsh.
  • Make sure that the command-line interpreters are installed on the devices.

How frequently is the script execution status reported with the portal?

The script run status is updated with the portal while the script is processed on the device. Whether the script succeeds, fails, is pending or is in progress, you can verify it from the Action History (Devices > Choose the Device > Action History) page of a device. It displays either of the statuses, Success, Pending, In Progress or Failed. If the script is supposed to display an output, it can be viewed by clicking the Show Output button. Even when the script fails, you can also verify the reason why it failed.

Does the script retry itself after failed execution?

Once executed, the Execute Custom Script action completes on the device showing the Failed or Success status. To run the scripts on a device again, the administrator should proceed with the action one more time.

Are other running processes suspended while executing shell scripts?

No, the shell script is executed as a different process. It operates in parallel with other running processes.

Is script execution performed only on the user accounts currently logged in?

No. During execution, the scripts are run across all the signed-in user accounts of the device.

Should I provide the password while executing commanding requiring root privileges?

No. Scripts are automatically executed with root privileges when they are initiated from the Hexnode portal. Hence, the Administrator password is not necessary for script execution.

How can I verify if the script is executed successfully?

From the Hexnode portal, go to the Manage tab and choose the device. Next, you can verify the execution status on the device’s Action History page. If the script was executed successfully, it shows a Success status. Otherwise, it displays Failed status.

Is it possible to validate a failed script from the Hexnode console?

In some cases, for instance, if your script returns output and fails to run, you can verify the reason for failure by accessing the info button displayed next to the Failed status. The Action history page of the device updates the script execution status.

Can the scripts once executed from the portal be run on other enrolled devices later?

Hexnode maintains a repository of scripts once executed from the portal. If you want to execute the same scripts on other devices later, you can choose the Hexnode repository as the script file source while performing the Execute Custom Script action. You may also download these scripts directly to the admin device from the Content tab.

  • FAQ