vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hello. I noticed (?) that one the cron jobs on my system seems to get executed a multiple number of times: --($:~)-- ps -ef | grep -v grep | grep start_backup root 28818 28817 0 03:38:34 ? 0:00 /bin/sh /.backup/start_backup root 20155 374 0 Sep 15 ? 0:00 sh -c /bin/sh /.backup/start_backup 2>&1 | /usr/bin/tee /tmp/backup.log root 28817 1 0 03:38:34 ? 0:00 /bin/sh /.backup/start_backup root 23711 374 0 Sep 16 ? 0:00 sh -c /bin/sh /.backup/start_backup 2>&1 | /usr/bin/tee /tmp/backup.log root 2201 2199 0 Sep 14 ? 0:00 /bin/sh /.backup/start_backup root 28175 374 0 Sep 14 ? 0:00 sh -c /bin/sh /.backup/start_backup 2>&1 | /usr/bin/tee /tmp/backup.log root 26764 1 0 Sep 16 ? 0:00 /bin/sh /.backup/start_backup root 26765 26764 0 Sep 16 ? 0:00 /bin/sh /.backup/start_backup root 23619 23617 0 Sep 15 ? 0:00 /bin/sh /.backup/start_backup root 25787 374 0 02:55:01 ? 0:00 sh -c /bin/sh /.backup/start_backup 2>&1 | /usr/bin/tee /tmp/backup.log root 23617 1 0 Sep 15 ? 0:00 /bin/sh /.backup/start_backup root 2199 1 0 Sep 14 ? 0:00 /bin/sh /.backup/start_backup This job should only be run once by the following cron job: --($:~)-- sudo crontab -l|grep start_ 55 2 * * * /bin/sh /.backup/start_backup 2>&1 | /usr/bin/tee /tmp/backup.log I wonder why the script seems to get executed more than once. The script doesn't call itself recursively, see <http://askwar.pastebin.ca/700390>. I'm refering to the lines 1, 3 and 3rd to last of the ps output I pasted above. What's going on there at 03:38:34? Thanks a lot, Alexander Skwar |
| |||
| The script seems to hang, as you have processes from Sep 14,15,16 and 17 (today) still alive. What's in /tmp/backup.log? Does the script actually ever get to the end? If you add a "echo `date` >> /tmp/starttimes.backup.log" to the beginning of the script, you will see when and if the script is actually started several times. I'm guessing that the script is done at 03:38 and leaves orphan processes as it does not exit cleanly. Regards, Arvid |
| |||
| On Sep 17, 7:59 am, Alexander Skwar <alexan...@skwar.name> wrote: > Hello. > > I noticed (?) that one the cron jobs on my system seems to get executed > a multiple number of times: > > --($:~)-- ps -ef | grep -v grep | grep start_backup > root 28818 28817 0 03:38:34 ? 0:00 /bin/sh /.backup/start_backup > root 20155 374 0 Sep 15 ? 0:00 sh -c /bin/sh /.backup/start_backup 2>&1 | /usr/bin/tee /tmp/backup.log > root 28817 1 0 03:38:34 ? 0:00 /bin/sh /.backup/start_backup > root 23711 374 0 Sep 16 ? 0:00 sh -c /bin/sh /.backup/start_backup 2>&1 | /usr/bin/tee /tmp/backup.log > root 2201 2199 0 Sep 14 ? 0:00 /bin/sh /.backup/start_backup > root 28175 374 0 Sep 14 ? 0:00 sh -c /bin/sh /.backup/start_backup 2>&1 | /usr/bin/tee /tmp/backup.log > root 26764 1 0 Sep 16 ? 0:00 /bin/sh /.backup/start_backup > root 26765 26764 0 Sep 16 ? 0:00 /bin/sh /.backup/start_backup > root 23619 23617 0 Sep 15 ? 0:00 /bin/sh /.backup/start_backup > root 25787 374 0 02:55:01 ? 0:00 sh -c /bin/sh /.backup/start_backup 2>&1 | /usr/bin/tee /tmp/backup.log > root 23617 1 0 Sep 15 ? 0:00 /bin/sh /.backup/start_backup > root 2199 1 0 Sep 14 ? 0:00 /bin/sh /.backup/start_backup > > This job should only be run once by the following cron job: > > --($:~)-- sudo crontab -l|grep start_ > 55 2 * * * /bin/sh /.backup/start_backup 2>&1 | /usr/bin/tee /tmp/backup.log > > I wonder why the script seems to get executed more than once. The script > doesn't call itself recursively, see <http://askwar.pastebin.ca/700390>. > I'm refering to the lines 1, 3 and 3rd to last of the ps output I pasted > above. What's going on there at 03:38:34? I suspect fairly strongly that the script either calls itself or perhaps forks a background job. Using ptree on some of the processes would probably be informative (for instance 23619 is a child of 23617, and I'm guessing 374 is cron). --tim |
| ||||
| Alexander Skwar wrote: > root 28818 28817 0 03:38:34 ? 0:00 /bin/sh /.backup/start_backup > root 28817 1 0 03:38:34 ? 0:00 /bin/sh /.backup/start_backup > I wonder why the script seems to get executed more than once. The script > doesn't call itself recursively, see <http://askwar.pastebin.ca/700390>. > I'm refering to the lines 1, 3 and 3rd to last of the ps output I pasted > above. What's going on there at 03:38:34? It is not executing more than once, it is forking. I guess the script is hanging in some of the loops or ( ) forks. |