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

Uploaded Python 3

File details

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

File metadata

  • Download URL: ovos_skill_cmd-0.3.1a1.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.1a1.tar.gz
Algorithm Hash digest
SHA256 8ed7b19796b2c23cbebee70531cb844ac546ea31452ce65881749967be8dbedb
MD5 fa1a8667b5d67307ca37a2d86fec9034
BLAKE2b-256 056457e962801e93a6121ac2eb601bd99547f2d58335c2fe09f4e8e2cacacdb0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ovos_skill_cmd-0.3.1a1-py3-none-any.whl
Algorithm Hash digest
SHA256 dad791071aae1c054bf8a7e9e95b39b1f7f406c20c74f41ad39e0feb8fd6282d
MD5 d3d7211a2112dadd77f876c8e6741e23
BLAKE2b-256 34c8aa7814130842389a087ada710ab77fc9e017e7c825aaa4e9736465d0a247

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