X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/balance2?a=blobdiff_plain;f=all_new_2018%2Fuser_scripts%2Fplomlombot_daemon.sh;h=df4f49d04d26468fe05252ba39b81a945c21d8d5;hb=9f911349477be35286ddafd553a500806325dca6;hp=dcac4f677c453f0f665a4e8ae66a001b88857270;hpb=cf999e4d2f8b8bd04ae908f2988bbba867e5c45e;p=config diff --git a/all_new_2018/user_scripts/plomlombot_daemon.sh b/all_new_2018/user_scripts/plomlombot_daemon.sh index dcac4f6..df4f49d 100755 --- a/all_new_2018/user_scripts/plomlombot_daemon.sh +++ b/all_new_2018/user_scripts/plomlombot_daemon.sh @@ -5,6 +5,7 @@ set -e path=~/.plomlombot db_dir="${HOME}/plomlombot_db" irclogs_dir=/var/www/html/irclogs +irclogs_pw_dir=/var/www/irclogs_pw while true; do if [ -f "${path}" ]; then cat "${path}" | while read line; do @@ -16,7 +17,14 @@ while true; do session_name=$(echo -n "${line}" | cut -d' ' -f2) bot_name=$(echo -n "${line}" | cut -d' ' -f3) channel_name=$(echo -n "${line}" | cut -d' ' -f4) + shortened_channel_name="${channel_name}" + first_char=$(echo -n "${channel_name}" | cut -c1) + if [ "${first_char}" = "#" ]; then + shortened_channel_name=$(echo -n "${channel_name}" | cut -c2-) + fi server_name=$(echo -n "${line}" | cut -d' ' -f5) + login_user=$(echo -n "${line}" | cut -d' ' -f6) + login_pw=$(echo -n "${line}" | cut -d' ' -f7) set +e screen -S "${session_name}" -Q select . > /dev/null start_screen=$? @@ -30,12 +38,8 @@ while true; do logs_dir="${db_dir}/${md5_server}/${md5_channel}/logs" # FIXME: Note the trouble we will have if we have the same channel # name on different servers … - shortened_channel_name="${channel_name}" - first_char=$(echo -n "${channel_name}" | cut -c1) - if [ "${first_char}" = "#" ]; then - shortened_channel_name=$(echo -n "${channel_name}" | cut -c2-) - fi ln -sfn "${logs_dir}" "${irclogs_dir}/${shortened_channel_name}" + htpasswd -c "${irclogs_pw_dir}/${shortened_channel_name}" "${login_user}" "${login_pw}" # If "key:" line, encrypt old raw logs to that GPG key. elif [ "${first_word}" = "gpg_key": ]; then