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.0a2.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.0a2-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ovos_skill_cmd-0.3.0a2.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.0a2.tar.gz
Algorithm Hash digest
SHA256 bc698059a2f8fe0aa84033e9aed8f804fd1e74212af5dfa1ca72b748da59e58a
MD5 4a00f11f750c71ed1c84c505af8ae648
BLAKE2b-256 4e274bb94042143d1e31fa634e27502b592b79ec34b2e74c5d116119c96044de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ovos_skill_cmd-0.3.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 3b393ea39a0d386315d0b18c34089d885a22066eb8639ba281e41e6ef520c394
MD5 1cfc34037b5c7884ba2ca23b934709a0
BLAKE2b-256 4aa15214cb007b435c5010f674685b09038fbbf235aa9936f4aafab235013ac4

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