Introduction
Introduction Statistics Contact Development Disclaimer Help
annna-join-channels - annna - Annna the nice friendly bot.
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6…
Log
Files
Refs
Tags
README
---
annna-join-channels (1100B)
---
1 #!/bin/sh
2
3 export PATH="$PATH:/home/annna/bin"
4
5 cfgbase="$(pwd)"
6 ircbase="$(cat ${cfgbase}/ircbase)"
7
8 server="$1"
9 channels="$2"
10
11 export ircuser="$(cat ${cfgbase}/${server}/ircuser 2>/dev/null)"
12
13 maxretries=32
14 # Channels
15 for chan in ${channels};
16 do
17 printf "/j %s\n" "${chan}" > ${ircbase}/${server}/in
18
19 # Do not flood.
20 sleep 1
21
22 ## Make sure the pipes are there.
23 tries=0
24 while [ ! -e "${ircbase}/${server}/${chan}/out" ];
25 do
26 [ ! -f ${cfgbase}/running ] && exit 1
27 tries=$(($tries + 1))
28 [ $tries -gt $maxretries ] && exit 1
29 sleep 1
30 done
31
32 tries=0
33 while [ ! -e "${ircbase}/${server}/${chan}/in" ];
34 do
35 [ ! -f ${cfgbase}/running ] && exit 1
36 tries=$(($tries + 1))
37 [ $tries -gt $maxretries ] && exit 1
38 sleep 1
39 done
40
41 tries=0
42 ## Check if we have joined and received the message from the ser…
43 while [ -z "$(cat ${ircbase}/${server}/${chan}/out \
44 | head -n 1 \
45 | grep ".* ${ircuser}.* ${chan}.*")" ];
46 do
47 [ ! -f ${cfgbase}/running ] && exit 1
48 tries=$(($tries + 1))
49 [ $tries -gt $maxretries ] && exit 1
50 sleep 2
51 done
52
53 annna-start-service "${server}" "${chan}"
54 done
55
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.