This repository has been archived on 2024-04-07. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/dotfiles/scripts/create-service

24 lines
311 B
Bash
Executable file

#!/bin/sh
testz() {
if test -z "$1"; then
echo "$2" >&2
exit 1
fi
}
testz "$1" "No service name provided"
pushd "/etc/runit/sv"
sudo mkdir -p "$1"
if ! test -f "$1/run"
then
printf '#!/bin/sh\n' | sudo tee "$1/run" > /dev/null
sudo chmod u+x "$1/run"
fi
sudo kak "$1/run"