LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Problem w/ .sh script (https://www.linuxquestions.org/questions/programming-9/problem-w-sh-script-477796/)

icetomyst 08-27-2006 10:25 AM

Problem w/ .sh script
 
im not too sure if this is the proper place for something like this but this site has helped me greatly in the past so i figured id give it a shot, quite frankly its my last hope

ok heres my problem, im running a CentOS linux game server, and its running a .sh script made to email admins of a problem people are having when someone issues the command !admin <message>, the script works and its all good.

Now, what im trying to do, is add onto that script so that it logs into an ICQ or AIM messenger account and IMs the <message> that was typed to a couple of my admins on ICQ or AIM. I've googled half the night and was unable to come up with anything useful...not to mention im a noob when it comes to .sh scripts. My biggest problem is that the script has to be contained in the one existing .sh file, i dont have the access to install anything like NET::AIM, NET::ICQ or gaim. The author of the script stated quite a few times on his website that he was able to add a few lines after the "mail" command to send messages via ICQ/AIM messengers, but never shared his additions to the origional script...i posted my problem there on his site about 3 months ago, but no one has seen or heard from the guy since december so im fairly certain my question will remain unanswered there.

I know its alot to ask of someone, but if ANYONE can come up with this it would be HUGELY appreciated. Heres the origional script called notify.sh:

Code:

#!/bin/sh


LOCKFILE=notify.lock
LOCKDIR=var
# LOCKDIR=/usr/local/games/enemy_territory/etadmin_mod/tools/locks

# Lock this script at least 30 minutes
LOCK=`find $LOCKDIR/ -cmin -30 -name $LOCKFILE`

if ( test -z "$LOCK" ) then
        # OK
        touch $LOCKDIR/$LOCKFILE
else
        # LOCKED
        echo "Admin already notified in the last 30 minutes."
        exit
fi

echo "Message from $2:"                >$LOCKDIR/$LOCKFILE
echo "$3"                                >>$LOCKDIR/$LOCKFILE
mail email@removed.com -s "FS Admin Notify"        <$LOCKDIR/$LOCKFILE

echo "Thank you $1^0. ^7An Admin has been notified..."

As you can see its quite simple, when someone issues !admin <message> it dumps the message into a file called notify.lock, then emails the set email address with the contents of notify.lock with the subject "FS Admin Notify", then locks the script for 30 minutes.

If anyone can figure out something that i could throw in after
"mail email@removed.com -s "FS Admin Notify" <$LOCKDIR/$LOCKFILE"
that logs into AIM or ICQ (doesnt matter which) sends the message to 3 or 4 names if then disconnects, then you could be an absolute lifesaver and i would proclaim you as a genious. Thanks in advance to anyone whos knowledgable enough to take this on.

debiant 08-27-2006 10:30 AM

I'm thinking you might get more responses throwing this into the Programming forum here, I would ask a mod to move it for me.

icetomyst 08-27-2006 10:33 AM

ah, thanks, could a mod please move this to Programming

timothyb89 08-27-2006 02:32 PM

Try libmsn (I think.
It's a command line based MSN messenger. You can send a message with a script like this:
Code:

msn;
m <username> <message>;


icetomyst 08-27-2006 02:56 PM

just tried it, wont run, i cant install the libraries, i only have ftp access to that server, and i dont have root or ssh access AND my host wont install anything thats not already there...which is why i really needed it to be just a connect/send/disconnect sh script that i can add to my current sh script...thats why its so hard for me to figure out. I mean i know it can be done, the guy who wrote the script used the same server host I do, so he couldnt install anything extra either yet ive actually witnessed it working for him, and the only information he mentioned about it is that he just added to the script in notify.sh that i posted above, but unfortunately he fell off the planet. Thanks for the attempt tho timothy, much appreciated. Hopefully someone that has written something similar in the past will get around to readin this.

icetomyst 08-29-2006 09:15 AM

soooo can i get a mod to put this in programming please?

Matir 08-29-2006 09:18 AM

Consider it moved to programming. In the future, click on the "report" link by your post and place it there: this will catch our attention and will end up with it being moved much sooner.


All times are GMT -5. The time now is 11:33 PM.