#2 question:# Specify here the filename Eggdrop will save its pid to. If no pidfile is
# specified, pid.(botnet-nick) will be used.
#set pidfile "pid.LamestBot"
Code: Select all
kill -9 `cat pid.LamestBot`
Code: Select all
check process eggdrop with pidfile /home/user/eggdrop
start = "/root/eggdrop start"
stop = "/root/eggdrop stop"
Code: Select all
#!/bin/bash
# set the user
user="username"
# and the path to eggdrop dir
path="/home/$user/eggdrop"
function getPid {
pid=0
file=`/bin/ls $path | grep pid`
if [ -n "$file" ]; then
pid=`cat $path/$file`
fi
}
function getStatus {
status=0
if pidof eggdrop | grep [0-9] > /dev/null; then
status=1
fi
}
function status {
getStatus
case "$status" in
0)
echo -e "offline"
;;
1)
echo -e "online"
;;
esac
}
function start {
getStatus
if [ "$status" -eq "0" ]; then
su $user
cd $path
rm -fr *.pid
./eggdrop
fi
}
function stop {
getStatus
if [ "$status" -eq "1" ]; then
getPid
kill -9 $pid
rm -fr $path/*.pid
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
status
;;
*)
echo "Usage: $0 {start|stop|status}"
esac
Code: Select all
root@server [/home/eggdrop]# /bin/su eggdrop /home/eggdrop/autobot/./autobot.sh start
/home/eggdrop/eggdrop/./eggdrop.sh: line 39: /bin/su: Permission denied
Eggdrop v1.6.20 (C) 1997 Robey Pointer (C) 2010 Eggheads
[17:38:06] --- Loading eggdrop v1.6.20 (Fri Apr 8 2011)
[14:38:06] Listening at telnet port 8362 (all).
[14:38:06] Module loaded: channels
[14:38:06] Module loaded: dns
[14:38:06] Module loaded: transfer (with lang support)
[14:38:06] Module loaded: share
[14:38:06] Module loaded: server
[14:38:06] Module loaded: ctcp
[14:38:06] Module loaded: irc
[14:38:06] Module loaded: notes (with lang support)
[14:38:06] Module loaded: console (with lang support)
[14:38:06] Module loaded: blowfish
[14:38:06] Module loaded: uptime
[14:38:06] RSS Syndication Script v0.5b1 (2007-12-17): Loaded.
[14:38:06] NickPlus : Loaded
[14:38:06] Writing channel file...
[14:38:06] Userfile loaded, unpacking...
[14:38:06] === eggdrop: 1 channels, 1 users.
Launched into the background (pid: 4986)
Code: Select all
su $user