# Script to activate remote ring on Mac

The remote ring feature has become very useful, especially for enterprises with a large number of devices to locate any misplaced device nearby. Using the [Execute Custom Script](https://www.hexnode.com/mobile-device-management/help/how-to-run-scripts-on-mac-using-hexnode-mdm/) action in Hexnode, you can activate the remote ring feature on Mac.

 Disclaimer:The sample scripts provided below are adapted from third-party open-source sites.

 

Script for remote ring
----------------------

Script to execute remote ring on Mac

count=1 while \[\[ $count -le rings \]\]; do count=$(( $count + 1 )) afplay <file path of sound file> done 

   1

2

3

4

5

6

7

8

9

10

11

  count=1

while \[\[ $count -le rings \]\];

do

count=$(( $count + 1 ))

afplay <file path of sound file>

done 

   

 

  

Replace `rings` with the number of times the device makes the ring sound. Based on it, the `count` variable uses the while loop to play the sound file which has been specified by its path.

For example, for the device to make seventeen rings with the ‘Submarine’ sound file:

`count=1 `

`while [[ $count -le 17 ]];  `

`do`

`count=$(( $count + 1 ))`

`afplay /System/Library/Sounds/Submarine.aiff`

`done `

 Notes:- It is recommended to manually validate the script execution on a system before executing the action in bulk.
- Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.