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
shelltofalse. - A command can run under a specific user through the
userfield. 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
- OpenVoiceOS/OpenVoiceOS — the OVOS platform this skill runs on.
License
Apache License 2.0. See LICENSE.txt.
Release files for ovos-skill-cmd 0.8.7a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ovos_skill_cmd-0.8.7a1.tar.gz | 15.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ovos_skill_cmd-0.8.7a1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 48.3 kB
Release files / ovos_skill_cmd-0.8.7a1.tar.gz
| Download URL | ovos_skill_cmd-0.8.7a1.tar.gz |
|---|---|
| Size | 15.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
de846b3b4322c979635dfe58db5c0b9d6ac57f84afa73e10603b19c7632ae91e
|
|
BLAKE2b-256 checksum How to use checksums |
49efc4312b3304a9bf51e159431f3c27c5b031cbbf469f7dfb48454a71149ba7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / ovos_skill_cmd-0.8.7a1-py3-none-any.whl
| Download URL | ovos_skill_cmd-0.8.7a1-py3-none-any.whl |
|---|---|
| Size | 32.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a9b9f3ce1e2853a4548d7cb0b69edecc0db26605e0790ff777a7cef2cb412cad
|
|
BLAKE2b-256 checksum How to use checksums |
0cdc5b22e86543377eea48e9cae5ea942d3a1cce99df29bd3637da2fc1ec567f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|