execute envs_gemini_genpage.sh in envs_user_updated.sh and not in a extra cronjob

This commit is contained in:
creme 2020-02-05 00:28:58 +01:00
parent 7643802f71
commit f2f71893ef
Signed by: creme
GPG Key ID: C147C3B7FBDF08D0
3 changed files with 26 additions and 21 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
#
# envs.net - generate index.gmi
# - this script is called by /etc/cron.d/envs_gemini
# - this script is called by /usr/local/bin/envs.net/envs_user_updated.sh
#
[ "$(id -u)" -ne 0 ] && printf 'Please run as root!\n' && exit 1

View File

@ -1,7 +1,11 @@
#!/usr/bin/env bash
#
# envs.net - generate user_updates.php and users_info.json
# - this script is called by /etc/cron.d/envs_sysinfo
# envs.net - generate the following static sites
# - users_info.json
# - user_updates.php
# - gemini index.gmi
#
# this script is called by /etc/cron.d/envs_sysinfo
#
WWW_PATH='/var/www/envs.net'
DOMAIN="envs.net"
@ -9,17 +13,6 @@ DOMAIN="envs.net"
[ "$(id -u)" -ne 0 ] && printf 'Please run as root!\n' && exit 1
#
# user_updates.php
#
LIST="$(stat --format=%Z\ %n /home/*/public_html/* | grep -v updated | grep -v your_index_template.php | grep -v cgi-bin | sort -r)"
echo "$LIST" | perl /usr/local/bin/envs.net/envs_user_updated_genpage.pl > /tmp/user_updates.php_tmp
mv /tmp/user_updates.php_tmp "$WWW_PATH"/user_updates.php
chown root:www-data "$WWW_PATH"/user_updates.php
#
# users_info.json
#
@ -228,5 +221,24 @@ EOM
mv "$TMP_JSON" "$WWW_PATH"/users_info.json
chown root:www-data "$WWW_PATH"/users_info.json
#
# user_updates.php
#
LIST="$(stat --format=%Z\ %n /home/*/public_html/* | grep -v updated | grep -v your_index_template.php | grep -v cgi-bin | sort -r)"
echo "$LIST" | perl /usr/local/bin/envs.net/envs_user_updated_genpage.pl > /tmp/user_updates.php_tmp
mv /tmp/user_updates.php_tmp "$WWW_PATH"/user_updates.php
chown root:www-data "$WWW_PATH"/user_updates.php
#
# gemini index.gmi
#
/usr/local/bin/envs.net/envs_gemini_genpage.sh
#
exit 0

View File

@ -1,7 +0,0 @@
#
# generate envs gemini - index.gem (once per hour)
#
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
0 * * * * root /usr/local/bin/envs.net/envs_gemini_genpage.sh >/dev/null 2>&1