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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73118fbb3ffafe36a3efeab72533550576402ab9327bc56aabc2afae1eaf8169
|
|
| MD5 |
df3a1d5a05e18aa27814635e8cb61884
|
|
| BLAKE2b-256 |
6800d38a3c2670cc534afbab2ec2a036cb44100438382b1160aff2a9c420015f
|
File details
Details for the file ovos_skill_cmd-0.3.0a1-py3-none-any.whl.
File metadata
- Download URL: ovos_skill_cmd-0.3.0a1-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd0994121850ce6ab8b2c595c4f696d2ad8a80a7caf43da2435fed950093e8c9
|
|
| MD5 |
002b7c7f9bbf99c1d1d2d338cc3271cd
|
|
| BLAKE2b-256 |
08a3af866c6a1797374504aab78379a993876a1facfbb7feca42687dce3f6fe1
|