X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=buster%2Fother_files%2Fplomlombot_daemon.sh;h=276c6021da9561874fcab0b50ac691fb4569ec46;hb=27942fc7dfadcc26b4fff15974af2b0faa675730;hp=2f267bdd790de87f2e6b2cbc3a37c53c774e5198;hpb=40b1aac9fad6b73589484750bc70968a260f945e;p=config diff --git a/buster/other_files/plomlombot_daemon.sh b/buster/other_files/plomlombot_daemon.sh index 2f267bd..276c602 100755 --- a/buster/other_files/plomlombot_daemon.sh +++ b/buster/other_files/plomlombot_daemon.sh @@ -6,6 +6,7 @@ path=~/.plomlombot db_dir="${HOME}/plomlombot_db" irclogs_dir=/var/www/html/irclogs irclogs_pw_dir=/var/www/irclogs_pw +hostname_mod_epoch=$(stat -c%Y /etc/hostname) while true; do if [ -f "${path}" ]; then cat "${path}" | while read line; do @@ -25,13 +26,14 @@ while true; do server_name=$(echo -n "${line}" | cut -d' ' -f5) login_user=$(echo -n "${line}" | cut -d' ' -f6) login_pw=$(echo -n "${line}" | cut -d' ' -f7) + add_option=$(echo -n "${line}" | cut -d' ' -f8-) set +e screen -S "${session_name}" -Q select . > /dev/null start_screen=$? set -e if [ "${start_screen}" -eq "1" ]; then cd ~/plomlombot-irc - LANG="en_US.UTF-8" screen -d -m -S "${session_name}" ./run.sh -r 604800 -n "${bot_name}" -s "${server_name}" "${channel_name}" + LANG="en_US.UTF-8" screen -d -m -S "${session_name}" ./run.sh -r 604800 -n "${bot_name}" -s "${server_name}" -c "${channel_name}" "${add_option}" fi md5_server=$(echo -n "${server_name}" | md5sum | cut -d' ' -f1) md5_channel=$(echo -n "${channel_name}" | md5sum | cut -d' ' -f1) @@ -46,7 +48,12 @@ while true; do key=$(echo -n "${line}" | cut -d' ' -f2) mkdir -p ~/plomlombot_db cd ~/plomlombot_db - find . -path '*/*/raw_logs/*.txt' -mtime +1 -type f -exec gpg --recipient "${key}" --trust-model always --encrypt {} \; -exec rm {} \; + # Dirty hack: To avoid trouble with GPG key expiration, fake + # system to something reasonbly old (younger than key creation, + # older than expiration) by taking the mod datetime of + # /etc/hostname, which should have last be changed when the + # system was set up. + find . -path '*/*/raw_logs/*.txt' -mtime +1 -type f -exec gpg --recipient "${key}" --trust-model always --faked-system-time="${hostname_mod_epoch}" --encrypt {} \; -exec rm {} \; fi done