- # Read "bot:" line, start bot screen session from it if not yet existing,
- # set up irclogs dir if not yet existing.
- if [ "${first_word}" = "bot:" ]; then
- session_name=$(echo -n "${line}" | cut -d' ' -f2)
- bot_name=$(echo -n "${line}" | cut -d' ' -f3)
- channel_name=$(echo -n "${line}" | cut -d' ' -f4)
- server_name=$(echo -n "${line}" | cut -d' ' -f5)
- set +e
- screen -S "${session_name}" -Q select . > /dev/null
- start_screen=$?
- set -e
- if [ "${start_screen}" -eq "1" ]; then
- cd ~/plomlombot-irc
- screen -d -m -S "${session_name}" ./run.sh -n "${bot_name}" -s "${server_name}" "${channel_name}"
- fi
- md5_server=$(echo -n "${server_name}" | md5sum | cut -d' ' -f1)
- md5_channel=$(echo -n "${channel_name" | md5sum | cut -d' ' -f1)
- 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 …
- ln -sf "${logs_dir}" "${irclogs_dir}/${channel_name}"
+ # Read "bot:" line, start bot screen session from it if not yet existing,
+ # set up irclogs dir if not yet existing.
+ if [ "${first_word}" = "bot:" ]; then
+ session_name=$(echo -n "${line}" | cut -d' ' -f2)
+ bot_name=$(echo -n "${line}" | cut -d' ' -f3)
+ channel_name=$(echo -n "${line}" | cut -d' ' -f4)
+ server_name=$(echo -n "${line}" | cut -d' ' -f5)
+ set +e
+ screen -S "${session_name}" -Q select . > /dev/null
+ start_screen=$?
+ set -e
+ if [ "${start_screen}" -eq "1" ]; then
+ cd ~/plomlombot-irc
+ screen -d -m -S "${session_name}" ./run.sh -n "${bot_name}" -s "${server_name}" "${channel_name}"
+ fi
+ md5_server=$(echo -n "${server_name}" | md5sum | cut -d' ' -f1)
+ md5_channel=$(echo -n "${channel_name}" | md5sum | cut -d' ' -f1)
+ 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 -sf "${logs_dir}" "${irclogs_dir}/${shortened_channel_name}"