2020-03-22 12:33:26 +00:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
2020-04-02 10:19:17 +00:00
|
|
|
rand=$(tr -dc 'a-f0-9' < /dev/urandom | head -c 16)
|
|
|
|
|
2020-03-22 12:33:26 +00:00
|
|
|
args=()
|
|
|
|
while getopts "u:s:e:d:cnw" opt
|
|
|
|
do case "$opt" in
|
2020-04-02 10:19:17 +00:00
|
|
|
u) args+=("--unit=$OPTARG-$rand");;
|
2020-03-22 12:33:26 +00:00
|
|
|
s) args+=("--slice=$OPTARG");;
|
|
|
|
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-04-02 10:19:17 +00:00
|
|
|
exec systemd-run --user --collect --unit="$1-$rand" ${args[@]} -- "$@"
|