#!/bin/bash : ' @vendor Chorke Academia, Inc. @web https://cdn.chorke.org/docs/academia @version 1.0.00 @since 1.0.00 ' :</dev/null;then sudo addgroup --quiet --system minio;fi if ! sudo id -u minio &>/dev/null;then sudo adduser --quiet --system --home ${MINIO_USER_HOME} --shell '/bin/bash' --ingroup minio --disabled-password minio fi sudo chown -R minio:minio ${MINIO_HOME_DIR} } function setting(){ sudo -i -u minio bash << EOF # format minio file system mkdir -p ${MINIO_USER_HOME}/.minio/data EOF } function install(){ cat << EOF | sudo tee /etc/default/minio >/dev/null MINIO_OPTS="--address :9800 --console-address :9801" MINIO_VOLUMES="${MINIO_USER_HOME}/.minio/data" MINIO_ROOT_USER=${MINIO_ADMIN_USER} MINIO_ROOT_PASSWORD=${MINIO_ADMIN_PASSWORD} MINIO_CONFIG_ENV_FILE=/etc/default/minio EOF sudo chown -R minio:minio ${MINIO_HOME_DIR} cat << EOF | sudo tee /etc/systemd/system/minio.service >/dev/null [Unit] Description=MinIO Documentation=https://docs.min.io Wants=network-online.target After=network-online.target AssertFileIsExecutable=${MINIO_HOME_DIR}/bin/minio [Service] WorkingDirectory=${MINIO_HOME_DIR} User=minio Group=minio ProtectProc=invisible EnvironmentFile=-/etc/default/minio ExecStartPre=/bin/bash -c "if [ -z \"\${MINIO_VOLUMES}\" ]; then echo \"Variable MINIO_VOLUMES not set in /etc/default/minio\"; exit 1; fi" ExecStartPost=/bin/bash -c "echo \$MAINPID > ${MINIO_HOME_DIR}/etc/minio.pid" ExecStart=${MINIO_HOME_DIR}/bin/minio server \$MINIO_OPTS \$MINIO_VOLUMES Restart=always SendSIGKILL=no TasksMax=infinity LimitNOFILE=1048576 TimeoutStopSec=infinity [Install] WantedBy=multi-user.target EOF } function launch(){ sudo systemctl daemon-reload sudo systemctl enable minio.service sudo systemctl start minio.service sudo systemctl status minio.service } function init(){ validate download approve setting install launch } init