0 Members and 1 Guest are viewing this topic.
root@crompugs:/srv/d_crompugs/www/crompugs.com/htdocs# ./bot.sh startStarting Bot/usr/bin/nohup: appending output to `nohup.out'Failed to start bot
#!/bin/sh BASEDIR="/srv/d_crompugs/www/crompugs.com/htdocs/BeBot" PHPBIN="/usr/lib/php5" CMD="${BASEDIR}/StartBot.php" # If you want to use your own INI file # set the location of the ini file and # comment out the two following lines #INI="${BASEDIR}/php.ini" #CMD="${PHPBIN} -c ${INI} ${BASEDIR}/bot.php" NOHUP=/usr/bin/nohup Error() { echo "Error: $1" exit 1 } [ -d ${BASEDIR} ] || Error "Make sure the BASEDIR variable is set The value ${BASEDIR} is not valid" [ -f "${BASEDIR}/StartBot.php" ] || Error "Make sure the BASEDIR variable is properly set I could not find helpbot.php in ${BASEDIR}" [ -x ${PHPBIN} ] || Error "Make sure the PHPBIN variable is set The value ${PHPBIN} is not valid" [ -x ${NOHUP} ] || Error "Make sure the NOHUP variable is set The value ${NOHUP} is not valid" case $1 in start*) PID=`/bin/ps x | /bin/grep -v grep | /bin/grep "$HOME/BeBot/StartBot" | awk '{ print $1; }'` ANS=0 [ "${PID}" != "" ] || ANS=1; if [ $ANS -eq 0 ] then echo "Bot already running PID=${PID}" else echo "Starting Bot" cd ${BASEDIR} ${NOHUP} ${CMD} & PID=`/bin/ps x | /bin/grep -v grep | /bin/grep "$HOME/BeBot/StartBot" | awk '{print $1;}'` if [ "$PID" = "" ] then echo "Failed to start bot" else echo "Bot Started" fi fi ;; stop*) PID=`/bin/ps x | /bin/grep -v grep | /bin/grep "$HOME/BeBot/StartBot" | awk '{ print $1; }'` ANS=0 [ "${PID}" != "" ] || ANS=1; if [ $ANS -eq 0 ] then echo "Stopping bot matching PID=$PID" kill ${PID} else echo "Bot is not running" fi ;; status*) PID=`/bin/ps x | /bin/grep -v grep | /bin/grep "$HOME/BeBot/StartBot" | awk '{ print $1; }'` ANS=0 [ "${PID}" != "" ] || ANS=1; if [ $ANS -eq 0 ] then echo "Bot running PID=$PID" else echo "Bot not running :(" fi ;; *) echo "Usage: $0 {start|stop|status}"; ;; esac
root@crompugs:/srv/d_crompugs/www/crompugs.com/htdocs# adduser htdocsAdding user `htdocs' ...Adding new group `htdocs' (1000) ...Adding new user `htdocs' (1002) with group `htdocs' ...Creating home directory `/home/htdocs' ...Copying files from `/etc/skel' ...Enter new UNIX password:Retype new UNIX password:passwd: password updated successfullyChanging the user information for htdocsEnter the new value, or press ENTER for the default Full Name []: Room Number []: Work Phone []: Home Phone []: Other []:Is the information correct? [y/N] yroot@crompugs:/srv/d_crompugs/www/crompugs.com/htdocs# ./bot.sh startError: Make sure the BASEDIR variable is set The value /ho[code]me/htdocs/BeBot is not valid
#!/bin/sh BASEDIR="/home/htdocs/BeBot" PHPBIN="/usr/lib/php5" CMD="${BASEDIR}/StartBot.php" # If you want to use your own INI file # set the location of the ini file and # comment out the two following lines #INI="${BASEDIR}/php.ini" #CMD="${PHPBIN} -c ${INI} ${BASEDIR}/bot.php" NOHUP=/usr/bin/nohup
and edited : PID=`/bin/ps x | /bin/grep -v grep | /bin/grep "$HOME/BeBot/StartBot" | awk '{print $1;}'`
root@crompugs:/srv/d_crompugs/www/crompugs.com/htdocs# ./bot.sh startError: Make sure the BASEDIR variable is set The value /home/htdocs/BeBot is not valid
cd /srv/d_crompugs/www/crompugs.com/htdocs/BeBot/; su -c "php5 StartBot.php" admin