Jump to content

how to close applications in linux


pixeltrace

Recommended Posts

hi,

 

linux newbie here.

 

i am running a specific php page using cron.

 

for 1 month already.

 

now, when i login to our linux server using putty

entering as root

then i type

ls -l

 

i notice that the page, that i am running under cron in a daily basis

has been opened for 29 times already and hasnt been closed.

 

how do i close them?

the files looked like this

-rw-r--r--   1 root root      12016 Jun 29 00:15 V3Uploader.php
-rw-r--r--   1 root root      11960 Jun 30 00:15 V3Uploader.php.1
-rw-r--r--   1 root root      11960 Jul  9 00:15 V3Uploader.php.10
-rw-r--r--   1 root root      11960 Jul 10 00:15 V3Uploader.php.11
-rw-r--r--   1 root root      11960 Jul 11 00:15 V3Uploader.php.12
-rw-r--r--   1 root root      11960 Jul 12 00:15 V3Uploader.php.13
-rw-r--r--   1 root root      11960 Jul 13 00:15 V3Uploader.php.14
-rw-r--r--   1 root root      11960 Jul 14 00:15 V3Uploader.php.15
-rw-r--r--   1 root root      11960 Jul 15 00:15 V3Uploader.php.16
-rw-r--r--   1 root root      11960 Jul 16 00:15 V3Uploader.php.17
-rw-r--r--   1 root root      11960 Jul 17 00:15 V3Uploader.php.18
-rw-r--r--   1 root root      11960 Jul 18 00:15 V3Uploader.php.19
-rw-r--r--   1 root root      11960 Jul  1 00:15 V3Uploader.php.2
-rw-r--r--   1 root root      11960 Jul 19 00:15 V3Uploader.php.20
-rw-r--r--   1 root root      11960 Jul 20 00:15 V3Uploader.php.21
-rw-r--r--   1 root root      11960 Jul 21 00:15 V3Uploader.php.22
-rw-r--r--   1 root root      11960 Jul 22 00:15 V3Uploader.php.23
-rw-r--r--   1 root root      11960 Jul 23 00:15 V3Uploader.php.24
-rw-r--r--   1 root root      10156 Jul 24 00:15 V3Uploader.php.25
-rw-r--r--   1 root root      10156 Jul 25 00:15 V3Uploader.php.26
-rw-r--r--   1 root root      10156 Jul 26 00:15 V3Uploader.php.27
-rw-r--r--   1 root root      10156 Jul 27 00:15 V3Uploader.php.28
-rw-r--r--   1 root root      10156 Jul 28 00:15 V3Uploader.php.29
-rw-r--r--   1 root root      11960 Jul  2 00:15 V3Uploader.php.3
-rw-r--r--   1 root root      10156 Jul 29 00:15 V3Uploader.php.30
-rw-r--r--   1 root root      10156 Jul 30 00:15 V3Uploader.php.31
-rw-r--r--   1 root root      10156 Jul 31 00:15 V3Uploader.php.32
-rw-r--r--   1 root root      22260 Aug  1 00:15 V3Uploader.php.33
-rw-r--r--   1 root root      22260 Aug  2 00:15 V3Uploader.php.34
-rw-r--r--   1 root root      11960 Jul  3 00:15 V3Uploader.php.4
-rw-r--r--   1 root root      11960 Jul  4 00:15 V3Uploader.php.5
-rw-r--r--   1 root root      11960 Jul  5 00:15 V3Uploader.php.6
-rw-r--r--   1 root root      11960 Jul  6 00:15 V3Uploader.php.7
-rw-r--r--   1 root root      11960 Jul  7 00:15 V3Uploader.php.8
-rw-r--r--   1 root root      11960 Jul  8 00:15 V3Uploader.php.9

 

and i want to close them.

hope you could help me with this.

 

thanks!

Link to comment
Share on other sites

how about ttrying ds command in the terminal

--> kill V3Uploader.php

or if u want to kill them individually

--> ps -ef | grep V3Uploader.php

ds will display all the V3Uploader.php processes

    from the display ... kill each process using its process id

    process id is the 2nd column next to the username...

    root      1515  3388  0 11:33 ?        00:00:00 sshd: root [priv]

    root      1513  3388  0 11:33 ?        00:00:00 sshd: root [priv]

    root      154    3388  0 11:33 ?        00:00:00 sshd: root [priv]

  --> kill 1515

Link to comment
Share on other sites

hi,

 

i tried the ps -f .... command and kill the

process id but the files are still there.

 

what other methods can i do?

also in my cron i used wget to run the php page

is there any additional codes that i need to add so after executing the page it automatically closes the php page?

 

hope you could help me with this.

thanks!

Link to comment
Share on other sites

hi,

 

i tried the ps -f .... command and kill the

process id but the files are still there.

 

what other methods can i do?

also in my cron i used wget to run the php page

is there any additional codes that i need to add so after executing the page it automatically closes the php page?

 

hope you could help me with this.

thanks!

 

If you do that then you'll need to kill all the process ids, not just one. You could also try killall V3Uploader.php

Link to comment
Share on other sites

hi,

 

i dont want to remove the application i just want to close it.

 

i tried killall and kill but i really cant close the application

 

whenever i used killall its telling me no process killed

whenever i used kill process id, its telling me no such process

 

i used

ps -ef|grep V3Uploader.php.37

and i got the process id from the second column

root     23193 23146  0 22:32 pts/0    00:00:00 grep V3Uploader.php.37

i type

kill 23193

but its telling me: no such process.

 

this is the entire application for v3uploader which i need to close

-rw-r--r--   1 root root      12016 Jun 29 00:15 V3Uploader.php
-rw-r--r--   1 root root      11960 Jun 30 00:15 V3Uploader.php.1
-rw-r--r--   1 root root      11960 Jul  9 00:15 V3Uploader.php.10
-rw-r--r--   1 root root      11960 Jul 10 00:15 V3Uploader.php.11
-rw-r--r--   1 root root      11960 Jul 11 00:15 V3Uploader.php.12
-rw-r--r--   1 root root      11960 Jul 12 00:15 V3Uploader.php.13
-rw-r--r--   1 root root      11960 Jul 13 00:15 V3Uploader.php.14
-rw-r--r--   1 root root      11960 Jul 14 00:15 V3Uploader.php.15
-rw-r--r--   1 root root      11960 Jul 15 00:15 V3Uploader.php.16
-rw-r--r--   1 root root      11960 Jul 16 00:15 V3Uploader.php.17
-rw-r--r--   1 root root      11960 Jul 17 00:15 V3Uploader.php.18
-rw-r--r--   1 root root      11960 Jul 18 00:15 V3Uploader.php.19
-rw-r--r--   1 root root      11960 Jul  1 00:15 V3Uploader.php.2
-rw-r--r--   1 root root      11960 Jul 19 00:15 V3Uploader.php.20
-rw-r--r--   1 root root      11960 Jul 20 00:15 V3Uploader.php.21
-rw-r--r--   1 root root      11960 Jul 21 00:15 V3Uploader.php.22
-rw-r--r--   1 root root      11960 Jul 22 00:15 V3Uploader.php.23
-rw-r--r--   1 root root      11960 Jul 23 00:15 V3Uploader.php.24
-rw-r--r--   1 root root      10156 Jul 24 00:15 V3Uploader.php.25
-rw-r--r--   1 root root      10156 Jul 25 00:15 V3Uploader.php.26
-rw-r--r--   1 root root      10156 Jul 26 00:15 V3Uploader.php.27
-rw-r--r--   1 root root      10156 Jul 27 00:15 V3Uploader.php.28
-rw-r--r--   1 root root      10156 Jul 28 00:15 V3Uploader.php.29
-rw-r--r--   1 root root      11960 Jul  2 00:15 V3Uploader.php.3
-rw-r--r--   1 root root      10156 Jul 29 00:15 V3Uploader.php.30
-rw-r--r--   1 root root      10156 Jul 30 00:15 V3Uploader.php.31
-rw-r--r--   1 root root      10156 Jul 31 00:15 V3Uploader.php.32
-rw-r--r--   1 root root      22260 Aug  1 00:15 V3Uploader.php.33
-rw-r--r--   1 root root      22260 Aug  2 00:15 V3Uploader.php.34
-rw-r--r--   1 root root      28303 Aug  3 00:15 V3Uploader.php.35
-rw-r--r--   1 root root      36264 Aug  4 00:15 V3Uploader.php.36
-rw-r--r--   1 root root      36264 Aug  5 00:15 V3Uploader.php.37
-rw-r--r--   1 root root      11960 Jul  3 00:15 V3Uploader.php.4
-rw-r--r--   1 root root      11960 Jul  4 00:15 V3Uploader.php.5
-rw-r--r--   1 root root      11960 Jul  5 00:15 V3Uploader.php.6
-rw-r--r--   1 root root      11960 Jul  6 00:15 V3Uploader.php.7
-rw-r--r--   1 root root      11960 Jul  7 00:15 V3Uploader.php.8
-rw-r--r--   1 root root      11960 Jul  8 00:15 V3Uploader.php.9

 

hope you could help me close this because its causing our server to slow down.

 

thanks so much!

Link to comment
Share on other sites

hi,

 

V3Uploader.php is setup in cron to execute the php page every 12am

and i used wget to run the php page.

 

below is the code for the v3uploader.php

<?php

include 'db_connect.php';

$uSql = "SELECT * FROM jos_findit";
$uResult = mysql_query($uSql, $connection);
if(!$uResult){
echo 'no data found';
}else{
while($uRow = mysql_fetch_array($uResult)){

$client = new SoapClient("http://203.125.7.42/mapguide/phpviewersample/V3UploaderWebService.wsdl",array("trace"=>1));

try
{	
$input=array('BuildingName'=>$uRow['TradeName'],'TradeBranch'=>$uRow['TradeBranch'],'TradeCode'=>$uRow['TradeCode'],'PostalCode'=>$uRow['PostalCode'],'CRUD'=>$uRow['CRUD']);
$result= $client->getUpdateResult($input);
$res = $result->getUpdateStatusReturns;

echo $res->updateStatus ."<BR><BR>";
echo "Request Header : ";
print htmlspecialchars($client->__getLastRequest()) . "\n<br><br>";
echo "Response Header : ";
print htmlspecialchars($client->__getLastResponse()) . "\n";
}
catch (SoapFault $exception)
{
echo $exception;
}
}
}
?>

 

 

also, is there any code that i can add in this php page so that after running the page,

it will automatically close it?

so in the future, i wont encounter the same issue on kill anymore.

 

hope you could help me with this.

 

thanks!

Link to comment
Share on other sites

ps -ef|grep V3Uploader.php.37

and i got the process id from the second column

root     23193 23146  0 22:32 pts/0    00:00:00 grep V3Uploader.php.37

i type

kill 23193

but its telling me: no such process.

 

That's because pid 23193 is the ID of the grep you ran on the output. Notice how it says "grep V3Uploader.php.37"? That's the grep you ran, not the application itself. If you do "ps ax | grep V3Uploader.php", and don't get any lines back other than the one for grep, then it's not running. And wget does automatically stop execution after a successful or failed fetch, so I suspect you might want to start looking elsewhere for the cause of your server's illness.

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.