0

I am using a VPS which is running 5 php scripts on a minute by minute basis using cron. Each script, itself, loops to execute a mysql query then sleeps for between 5 and 15 seconds. They all terminate after a minute of execution - and are then triggered back into life by the cron. The queries are to determine the kind of activity taking place and then they may take some sort of related action.

The hosting company tells me that this is using too much resource and is impacting other users. Whilst the queries run frequently, they are not supposed to be burdensome. What is the best way to monitor how much resource each script is using? I have shell access but I do not see them in the ps -A or in top.

Help appreciated

2
  • You should be able to see them in top while they really running. After all they are executed, so they should be mentioned in the output of top. Did company tell you which resources - CPU? RAM? There is memory-get-usage function. For CPU I would watch top more carefully.
    – VL-80
    Jan 1, 2014 at 14:52
  • @Nikolay - yep, they are there, I just needed to add the -c option. See the answer below. One of the scripts was running a mysql query which took 56s to complete! Now optimising. Thanks.
    – anthonyc
    Jan 1, 2014 at 20:38

1 Answer 1

0

The processes are visible in top but it just shows php with no details - until you add the -c (command line) option which shows the full path of the script being run by cron.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .