correr en baja prioridad y enviar un mensaje al compilar

This commit is contained in:
f 2018-03-21 05:03:13 -03:00
parent 7bdb785858
commit 9553530637
No known key found for this signature in database
GPG key ID: F3FDAB97B5F9F7E7

View file

@ -30,6 +30,8 @@ find -L ./_sites -mindepth 3 -maxdepth 3 -name .generate \
# Ya que estamos, eliminamos la ruta donde estamos paradas para no dar
# información sobre la servidora.
touch .generating
# Correr en baja prioridad
nice -n 19 \
bundle exec \
jekyll build --trace --destination "${_deploy}" 2>&1 \
| sed -re "s,${_path},,g" \
@ -40,11 +42,13 @@ find -L ./_sites -mindepth 3 -maxdepth 3 -name .generate \
if test $? -eq 0; then
# Si funciona, enviar un mail
# TODO enviar un mail más completo y no hardcodear direcciones
mail -b "sysadmin@kefir.red" \
echo "Everything was good! You can see your changes in https://${_site}" \
| mail -b "sysadmin@kefir.red" \
-s "${_site}: :)" \
${_mail[@]}
else
mail -b "sysadmin@kefir.red" \
echo "There was an error, please check build log at https://sutty.kefir.red/" \
| mail -b "sysadmin@kefir.red" \
-s "${_site}: :(" \
${_mail[@]}
date +%s >.failed
@ -52,6 +56,10 @@ find -L ./_sites -mindepth 3 -maxdepth 3 -name .generate \
# Eliminar el archivo para sacar el sitio de la cola de compilación
rm -f .generate .generating
# TODO descubrir el grupo según la distro?
chgrp -R http "${_deploy}"
find "${_deploy}" -type f -print0 | xargs -0 chmod 640
find "${_deploy}" -type d -print0 | xargs -0 chmod 2750
# Volver al principio para continuar con el siguiente sitio
popd &>/dev/null