Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

OVOS Cmd Skill

This OVOS skill runs shell scripts and other commands. The commands run without asking for confirmation.

Install

pip install ovos-skill-cmd

Usage

Trigger a command with a spoken phrase:

  • "Hey Mycroft, launch command echo TEST"
  • "Hey Mycroft, run script generate report"

Configuration

Configure the skill in settings.json. Map a spoken phrase to a script or command under alias. For example:

{
  "alias": {
    "generate report": "/home/forslund/scripts/generate_report.sh"
  }
}

With this setting, the phrase "run script generate report" makes the skill execute /home/forslund/scripts/generate_report.sh.

user

Set user to run commands under a specific user's privileges:

{
  "user": "ovos"
}

shell

Set shell to control whether commands run through a shell. It defaults to true:

{
  "shell": false
}

Full example

{
  "user": "ovos",
  "alias": {
    "generate report": "/home/forslund/scripts/generate_report.sh",
    "update system": "sudo apt update && sudo apt upgrade -y",
    "reboot device": "sudo reboot"
  },
  "shell": true
}

Security notes

  • Running commands through a shell allows complex operations but can expose security risks. If your commands do not need shell features, set shell to false.
  • A command can run under a specific user through the user field. Make sure that user has the permissions the command needs.
  • Do not configure dangerous commands, such as rm -rf, without additional safeguards.

Docker containers

Commands run only inside the Docker container. If a command also needs an effect outside the container, use an additional mechanism, such as a named pipe.

This example steers Kodi, which runs outside the container, from ovos-skill-cmd:

{
    "alias": {
        "kodi restart": "echo \"systemctl restart kodi\" > /home/ovos/.config/mycroft/joespipe",
        "kodi mute": "echo \"kodi-send --action=\\\"Mute\\\"\" > /home/ovos/.config/mycroft/joespipe",
        "kodi unmute": "echo \"kodi-send --action=\\\"Mute\\\"\"  > /home/ovos/.config/mycroft/joespipe",
        "kodi louder": "echo \"kodi-send --action=\\\"VolumeUp\\\"\" > /home/ovos/.config/mycroft/joespipe",
        "kodi lower": "echo \"kodi-send --action=\\\"VolumeDown\\\"\" > /home/ovos/.config/mycroft/joespipe",
        "kodi pause": "echo \"kodi-send --action=\\\"PlayerControl(Play)\\\"\" > /home/ovos/.config/mycroft/joespipe",
        "kodi resume": "echo \"kodi-send --action=\\\"PlayerControl(Play)\\\"\" > /home/ovos/.config/mycroft/joespipe",
        "kodi stop": "echo \"kodi-send --action=\\\"PlayerControl(Stop)\\\"\" > /home/ovos/.config/mycroft/joespipe"
    },
    "shell": true,
    "__mycroft_skill_firstrun": false
}

/home/ovos/.config/mycroft/joespipe is a named pipe in the shared volume of the OVOS config folder. Outside the container, a small script watches the pipe for commands:

#!/bin/bash
while true; do eval "$(cat /storage/ovos/config/joespipe)"; done

Read more about this named-pipe approach on Stack Overflow.

Related projects

License

Apache License 2.0. See LICENSE.txt.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ovos_skill_cmd-0.3.0a1.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ovos_skill_cmd-0.3.0a1-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file ovos_skill_cmd-0.3.0a1.tar.gz.

File metadata

  • Download URL: ovos_skill_cmd-0.3.0a1.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for ovos_skill_cmd-0.3.0a1.tar.gz
Algorithm Hash digest
SHA256 73118fbb3ffafe36a3efeab72533550576402ab9327bc56aabc2afae1eaf8169
MD5 df3a1d5a05e18aa27814635e8cb61884
BLAKE2b-256 6800d38a3c2670cc534afbab2ec2a036cb44100438382b1160aff2a9c420015f

See more details on using hashes here.

File details

Details for the file ovos_skill_cmd-0.3.0a1-py3-none-any.whl.

File metadata

File hashes

Hashes for ovos_skill_cmd-0.3.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 fd0994121850ce6ab8b2c595c4f696d2ad8a80a7caf43da2435fed950093e8c9
MD5 002b7c7f9bbf99c1d1d2d338cc3271cd
BLAKE2b-256 08a3af866c6a1797374504aab78379a993876a1facfbb7feca42687dce3f6fe1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page