2020-03-22 12:33:26 +00:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
2020-08-18 11:49:31 +00:00
|
|
|
rand=$(tr -dc 'a-f0-9' < /dev/urandom | head -c 8)
|
2020-04-02 10:19:17 +00:00
|
|
|
|
2020-03-22 12:33:26 +00:00
|
|
|
args=()
|
2020-08-18 11:49:31 +00:00
|
|
|
while getopts "s:e:d:cnw" opt
|
2020-03-22 12:33:26 +00:00
|
|
|
do case "$opt" in
|
2020-08-18 11:49:31 +00:00
|
|
|
s) slice="$OPTARG";;
|
2020-03-22 12:33:26 +00:00
|
|
|
e) args+=("--setenv=$OPTARG");;
|
|
|
|
d) args+=("--working-directory=$OPTARG");;
|
|
|
|
c) args+=("--scope");;
|
|
|
|
n) args+=("--no-block");;
|
|
|
|
w) args+=("--wait");;
|
|
|
|
*) shift;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
shift $((OPTIND-1))
|
|
|
|
|
2020-08-18 11:49:31 +00:00
|
|
|
if [ -z "$slice" ]; then
|
|
|
|
slice=app
|
|
|
|
fi
|
|
|
|
|
|
|
|
exec systemd-run \
|
|
|
|
--user \
|
|
|
|
--collect \
|
|
|
|
--slice="$slice" \
|
|
|
|
--unit="$slice-$1-$rand" \
|
|
|
|
${args[@]} -- "$@"
|