Register
It is currently Fri Oct 24, 2014 8:46 pm

BInMe Bash INstant MEssenger


All times are UTC - 6 hours


Post new topic Reply to topic  [ 1 post ] 
Author Message
 PostPosted: Mon Oct 02, 2006 4:28 am   

Joined: Fri Oct 14, 2005 9:30 am
Posts: 61
Here is my script:
Code:
#!/bin/bash
##########start functions##########
roomdir="/home/everyone/ircrooms"
function joinroom ()
{
read -p "What is the name of the room you would like to join/start : " roomname
if [[ -e $roomdir/$roomname.html ]]
then
   echo "$roomname.html exists - you will be talking in $roomname"
   choosename
else
   echo "$roomname.html does not exist, it will be created and you will be talking in $roomname"
   sleep 1
   echo "
<head>
<title>BInMe - Bash INstant MEssenger</title>
</head>
<meta http-equiv="refresh" content="1">" &> $roomdir/$roomname.html
   choosename
fi
}

function choosename ()
{
read -p "What do you want your chat name to be: " chatname
}

function chat ()
{
read -p "Message:    " message
echo "<P>$chatname: $message</P>" >> $roomdir/$roomname.html
clear
chat
}
##########end functions##########
##########start program##########
joinroom
chat

This script allows 2 or more people to communicate using this script and a web browser of their choice. So far I have only tested it over my home network but it is still the same process.

To work it over the internet - you need:
SSH server
and
a web server of your choice (I will show how to set it up with apache).

(Web server is optional really but it is much better to use it IMO).

To get it working (assuming you have already installed apache and ssh + forwarded port 80 and 22 if neccessary), you need to:
1. Place the script in /usr/bin/ (right click here - save as to download)
2. Make sure you have two users that both have permission to access one folder on your system.
3.Then create a folder inside the folder they can access and call it what you want - this will be your roomdir variable in the script. Or you can just run the script with both users as root - it will work fine but a bit insecure ;).
4. Add the following alias to your apache httpd.conf file in the alias section
Alias /binme "<your roomdir variable path>"
5. (re)start apache.
6. User 1 runs "binme" - sets his/her roomname and user name - and opens <your server address>/binme/<your room name>.html in their favourite browser. If he/she then types a message using the binme script, they will be able to see it on the html page.
7. User 2 ssh's into user 1's pc, logs in and runs "binme", enters the same roomname as user 1 and sets his/her chatname. He/she then opens <your server address>/binme/<your room name>.html in their favourite browser and using the "binme" script can send messages to the html file which can be read by user 1.

I think those instructions should work - that is how i set it up over my network.

Rob


Top
 Profile WWW  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP