Jump to content

php exec


alin19

Recommended Posts

i have a bash script that i was running with cron jobs:

 

#! /bin/bash
start=1000
homedir="/home/alin/NetBeansProjects/Fragger2"

numberofprocess=`expr $start + $2`

i=$start

currentnumber=`ps ax |  grep index | grep -c php`

case "$1" in
  start)

        while [ $i -lt $numberofprocess ]
                do
                   if [ `ps axo cmd | grep  index | grep php | grep -c $i` -lt 1 ] ; then

                   
                   /server/php/bin/php $homedir/index.php $i &
                   
                   fi;
                   
                   i=`expr $i + 1`
                   
        done
       ;;
   stop)
        while [ $currentnumber -ne 0 ]
        do
                kill -9 `ps ax | grep php | grep index | awk {'print $1'} | head -n 1`;

                currentnumber=`ps ax |  grep index | grep -c php`
        done
        
      ;;

  *)
echo "Usage : " $0 "start|stop"
        ;;

esac
exit 0

 

and it was working fine,

 

now i'm tring to make it run from a page .

 

if(isset ($_POST['stop'])){
    $conn->update("update `links` set `proccess`=0 ");
    exec("/home/alin/NetBeansProjects/Fragger2/Trans stop 0");
}


if(isset ($_POST['start'])){
    if(!preg_match("/^[0-9]+$/", $_POST['proccess']))
            echo "proccess should be only a number!";
    
    exec("/home/alin/NetBeansProjects/Fragger2/Trans start ".$_POST['proccess']);
}

 

and i don't know why it is not working,

 

i have set for this folder all the permision for this folder  "chmod -R 777 /home/alin"

 

it doesn't stop running and i can't figure out why

 

i have to kill the procces from the comand line to stop

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.