Skip to content

Commit

Permalink
Add container-aware service wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitry-ishenko authored and igorpecovnik committed Dec 11, 2024
1 parent 82a1e9f commit 4c4822e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tools/modules/functions/service.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# service.sh

declare -A module_options
module_options+=(
["service,author"]="@dimitry-ishenko"
["service,desc"]="Wrapper for service manipulation"
["service,example"]="service install some.service"
["service,feature"]="service"
["service,status"]="active"
)

function service()
{
# ignore these commands, if running inside container
[[ "$1" =~ ^(reload|restart|start|status|stop)$ ]] && systemd-detect-virt -qc && return 0
systemctl "$@"
}

0 comments on commit 4c4822e

Please sign in to comment.