代码拉取完成,页面将自动刷新
#!/bin/sh
if [ $(id -u) -eq 0 ]; then
export RUN_USER="root"
if [ $UID -gt 0 ] && [ $GID -gt 0 ]; then
export RUN_USER=$(getent passwd "$UID" | cut -d: -f1)
if [ -z $RUN_USER ]; then
export RUN_USER="container"
fi
# if the specify user not exists, create it
if [ -z "$(cat /etc/passwd | grep :$UID:$GID:)" ]; then
# delete user and group if exists
(/usr/sbin/deluser $RUN_USER > /dev/null)
(/usr/sbin/delgroup $RUN_USER > /dev/null)
# create user
/usr/sbin/addgroup --gid $GID $RUN_USER
/usr/sbin/adduser --disabled-password --gecos "" --home /var/www --ingroup container --no-create-home --uid $UID $RUN_USER
# create config folder
mkdir -p /var/www/.config
chown -R $UID:$GID /var/www/.config
fi
export APACHE_RUN_USER=$RUN_USER
export APACHE_RUN_GROUP=$RUN_USER
fi
# export the container user
if [ -z "$(cat /root/.env | grep RUN_USER=$RUN_USER)" ]; then
echo "export RUN_USER=$RUN_USER" >> /root/.env
echo "export APACHE_RUN_USER=$RUN_USER" >> /root/.env
echo "export APACHE_RUN_GROUP=$RUN_USER" >> /root/.env
echo ". /root/.env" >> /root/.bashrc
fi
# start supervisord
if [ `expr match "$SUPERVISORD" "[O|o][N|n]$"` -ne 0 ]; then
(/usr/bin/supervisord -c /usr/local/etc/supervisord.conf > /dev/null) &
echo "supervisord started"
fi
# start cron
if [ `expr match "$SCHEDULE" "[O|o][N|n]$"` -ne 0 ]; then
/usr/bin/crontab /usr/local/etc/crontab.txt
/etc/init.d/cron start
echo "cron started"
fi
else
echo "You should specify the execution user by '-e UID=1000' and '-e GID=1000'."
exit 1
fi
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。