Sha256: 8fd06101e05facf53b3438c27cff856d74c6ea47749b54c4f680a85afbc73286

Contents?: true

Size: 781 Bytes

Versions: 2

Compression:

Stored size: 781 Bytes

Contents

#!/bin/bash

set -e

NAME=${1}
CMD=${2}
USER=${3:-root}
DIR=${4:-/}
RUN_FILE="/etc/sv/${NAME}/run"
LOG_FILE="/etc/sv/${NAME}/log/run"

USAGE="Usage: sv-gen <name> <command> [user] [directory]"

if [ "x${1}" = "x" ] ; then
  echo $USAGE
  exit 1
fi

if [ "x${2}" = "x" ] ; then
  echo $USAGE
  exit 1
fi

echo " ---> create /etc/sv/${NAME}"
mkdir -p /etc/sv/${NAME}

echo " ---> create ${RUN_FILE}"
cat > $RUN_FILE << EOF
#!/bin/sh
set -e
exec 2>&1
cd ${DIR}
CMD="${CMD}"
exec chpst -u ${USER} \$CMD 2>&1
EOF
chmod +x ${RUN_FILE}

echo " ---> create /etc/sv/${NAME}/log"
mkdir -p /etc/sv/${NAME}/log

echo " ---> create ${LOG_FILE}"
cat > $LOG_FILE << EOF
#!/bin/sh
set -e
LOG=/var/log/${NAME}

test -d "\$LOG" || mkdir -p m2750 "\$LOG"
exec svlogd "\$LOG"
EOF
chmod +x ${LOG_FILE}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
evrone-ci-worker-0.2.0.pre1 docker/sv-gen
evrone-ci-worker-0.2.0.pre0 docker/sv-gen