5

I have placed a .sh file that runs a php script weekly.

This script should run only once, but every sunday it runs at:

  • 1:30 am
  • 6:50 am

Any way to fix this?

OH CRAP

in the first email the user agent that request that email via web is: [HTTP_USER_AGENT] => Lynx/2.8.5rel.1 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/1.4.4

and guess who is the IP of the REQUEST ? it's the IP of my old server (where was setted the same cron job)

It's like the old server is requesting that cron via web, I just need to delete the cron job to my old server

30
  • 2
    In addition, please post the contents of /etc/crontab, which should define the schedule for run-parts.
    – beans
    Mar 6, 2011 at 11:58
  • 3
    Well the 6:50 time is specified in the crontab file, so that one makes sense. The 1:30 time isn't. Is someone's personal crontab running the program in question (or executing some other part)?
    – Chris S
    Mar 6, 2011 at 14:28
  • 2
    You might put a ps -jHF and env in your job to show the process tree and environtment for the job. That might help you find what's starting it.
    – beans
    Mar 7, 2011 at 2:10
  • 2
    Yes. In the shell script. Anywhere after #!/bin/bash
    – beans
    Mar 8, 2011 at 13:52
  • 1
    output from a cron job should be mailed to the user. Check your user's mail. It looks like your crontab is set up to run the weekly job as root.
    – beans
    Mar 8, 2011 at 19:00

2 Answers 2

1

The job is being run by Apache at 1:27, not cron:

ps: www-data  9385  2405  2405  2405  0 47638 12984   1 Mar08 ?        00:00:00 /usr/sbin/apache2 -k start

env: APACHE_LOCK_DIR=/var/lock/apache2

Is httpd being restarted around that time? (Some startup code could be running this.) Alternately, does www-data have a crontab?

7
  • nope httpd isn't restarted. And how can I check www-data crontaqb?
    – dynamic
    Mar 14, 2011 at 20:43
  • There would usually be a file named /var/spool/cron/crontabs/www-data, or just use the following to edit their crontab: sudo crontab -u www-data -e
    – Paul Doom
    Mar 15, 2011 at 1:37
  • @paul: I added the full command output in first post. As you stated the cron of 1:27 is requested with the REQUEST_URI setted, like someone requested it via web (impossibile) How Can I solve this? [in crontabs there are 0 file]
    – dynamic
    Mar 20, 2011 at 9:59
  • Check your HTTPD access.log and error.log for that time period. (Probably under /var/log/apache/) I don't think you have anything nefarious going on here, probably just some additional automation. For instance, a backup job could be calling it as a pre-backup task.
    – Paul Doom
    Mar 20, 2011 at 17:54
  • I don't have any backup, this was a clean debian installation (from ovh) and i have installed only apache-php-mysql =/
    – dynamic
    Mar 20, 2011 at 18:23
0

I believe this will be relevant..

Under ubuntu or debian, you can view crontab by /var/spool/cron/crontab/ and then a file for each user is in there. That's only for user specific crontab's of course

By the way i got that from here....https://stackoverflow.com/questions/134906/how-do-i-list-all-cron-jobs-for-all-users

You must log in to answer this question.

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