server goes day at 4am everyday

my server stops responding at 4am everyday so I have to manually reboot it!
my server is running on centos v4.4 can someone please help me?
I really need to fix this problem!
Who is Participating?
Kerem ERSOYConnect With a Mentor PresidentCommented:
It is obvious that your system is locked during you run cron.daily.

- Did you try to check your mem ? It is easy just boot the install cd and and type "memtest86" (without " characters) and enter. It will get into test memory mode and it will start immediately. When you're doe just press ESC to reboot.

- Did you try to launch the scripts manually ? Does it lock the computer when launched this way ? You can loanch the script such as:
bash -x /script/to/run

so that it will print the command it runs interactively during the execution. You may also include the -x switch to the beginning of your files in the cron.daily folder like that

#!/bin/bash -x

in this case the utput fom your script will be emailed to you while running. But the preferred method is running them manually:
- Switchh yo the folder:
cd /etc/cron.daily
- Run all executable files in the directory one by one with bash -x
> my server stops responding at 4am everyday so I have to manually reboot it!

Cat You verify what applications are beeing run from crontab daily?
and content from /etc/cron.daily/
SabrinAuthor Commented:
[(06:39 AM)][(root@dedicated)] [(~)] $ vi /etc/crontab

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

[(06:40 AM)][(root@dedicated)] [(~)] $ cd /etc/cron.daily/

[(06:36 AM)][(root@dedicated)] [(/etc/cron.daily)] $ ll
total 164
lrwxrwxrwx  1 root root   28 Oct 13 21:03 00-logwatch -> ../log.d/scripts/
-rwxr-xr-x  1 root root  418 Apr 26  2006 00-makewhatis.cron
-rwxr-xr-x  1 root root  276 Feb 21  2005 0anacron
yum.cron (END)
-rw-r--r--  1 root root  851 Sep 28 14:13 0fpusage
-rwxr-xr-x  1 root root   85 Oct 16 15:17 0virtualhosting.site1
-rwxr-xr-x  1 root root   86 Oct 16 15:32 0virtualhosting.site10
-rwxr-xr-x  1 root root   86 Oct 16 15:33 0virtualhosting.site11
-rwxr-xr-x  1 root root   86 Oct 16 15:34 0virtualhosting.site12
-rwxr-xr-x  1 root root   86 Oct 16 15:34 0virtualhosting.site13
-rwxr-xr-x  1 root root   86 Oct 16 14:19 0virtualhosting.site14
-rwxr-xr-x  1 root root   86 Oct 17 14:13 0virtualhosting.site15
-rwxr-xr-x  1 root root   85 Oct 16 15:20 0virtualhosting.site2
-rwxr-xr-x  1 root root   85 Oct 16 15:24 0virtualhosting.site3
-rwxr-xr-x  1 root root   85 Oct 16 15:25 0virtualhosting.site4
-rwxr-xr-x  1 root root   85 Oct 16 15:28 0virtualhosting.site5
-rwxr-xr-x  1 root root   85 Oct 16 15:30 0virtualhosting.site6
-rwxr-xr-x  1 root root   85 Oct 16 15:30 0virtualhosting.site7
-rwxr-xr-x  1 root root   85 Oct 16 15:31 0virtualhosting.site8
-rwxr-xr-x  1 root root   85 Oct 16 15:32 0virtualhosting.site9
-rwxr-xr-x  1 root root  241 Sep 28 14:12 1gen_analog_data
-rwxr-x---  1 root root  168 Sep 28 14:12 1hup_apache_logs
-rw-r--r--  1 root root  797 Feb 21  2005 certwatch
-rwx------  1 root root  257 Sep 28 14:15 check_quotas
-rwxr-xr-x  1 root root  998 Jun  1  2004 clean.quarantine
-rwxr-xr-x  1 root root  456 Jan  9  2006 freshclam
-rwxr-xr-x  1 root root  180 Aug 22  2005 logrotate
-rwxr-xr-x  1 root root  345 Jul 17 08:01
-rwxr-xr-x  1 root root 2133 Dec  1  2004 prelink
-rwx------  1 root root   83 Sep 28 14:10 rm_oneclick
-rwxr-xr-x  1 root root  104 Aug 12 17:01 rpm
-rwxr-xr-x  1 root root  121 Aug 21  2005 slocate.cron
-rwxr-xr-x  1 root root  286 Feb 21  2005 tmpwatch
-rwx------  1 root root   68 Sep 28 14:10 vacuumdb
-rwxr-xr-x  1 root root   51 Sep 28 14:13 wltouch.daily
-rwxr-xr-x  1 root root  158 Aug 12 13:40 yum.cron
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

One of those scripts from /etc/cron.daily  is downing the server. Simply try running them one by one - maybe one of them will not return ;)
Kerem ERSOYPresidentCommented:

This might as well be as a part of a hardware failure sch as RAM or Hard Disk failure. And since the system llocks yp I'll suggest you to reboot in memetest mode gram the grub and check your memory throughly. (IT seems to me that it is very likely to be a RAM error since the system locks up.)

Then you can fsck all your volumes.
SabrinAuthor Commented:
how can I test it ?
Kerem ERSOYPresidentCommented:
- Just boot-off the install CD
- When theinitial prompt appears type "memtest86" enter
It will start the RAM test.
SabrinAuthor Commented:
whats this script in /etc/cron.daily?

/usr/sbin/chroot /home/virtual/site1/fst /usr/bin/run-parts /etc/cron.daily
It fires chained cron jobs from directory: /home/virtual/site1/fst/etc/cron.daily
Note - that they are run as root, therefore may cause damage as well.
SabrinAuthor Commented:
this are the scripts in that dir!
I think one of the sites are taking down the server!

[(03:38 AM)][(root@dedicated)] [(/home/virtual/site1/fst/etc/cron.daily)] $ ls

00-makewhatis.cron  00updatestats  rmattachments

[(03:38 AM)][(root@dedicated)] [(/home/virtual/site1/fst/etc/cron.daily)] $ less 00-makewhatis.cron



# the lockfile is not meant to be perfect, it's just in case the
# two makewhatis cron scripts get run close to each other to keep
# them from stepping on each other's toes.  The worst that will
# happen is that they will temporarily corrupt the database...
[ -f $LOCKFILE ] && exit 0
trap "{ rm -f $LOCKFILE ; exit 255; }" EXIT
makewhatis -u -w
exit 0

[(03:39 AM)][(root@dedicated)] [(/home/virtual/site1/fst/etc/cron.daily)] $ less 00updatestats

# --------------------------------------------------------------------------
# Copyright (c) Ensim Corporation 2000, 2001

# --------------------------------------------------------------------------
# $Id: updatestats,v 1.13 2005/07/28 10:47:00 mborate Exp $
# $Name: epl-10-1-0-branch $
# --------------------------------------------------------------------------
/usr/lib/opcenter/analog/ /var/usage/web $APACHE_LOG >/dev/null 2>/dev/null
/usr/lib/opcenter/analog/ /var/usage/ftp /var/log/xferlog  >/dev/null 2>/dev/null

[(03:39 AM)][(root@dedicated)] [(/home/virtual/site1/fst/etc/cron.daily)] $ less rmattachments

# --------------------------------------------------------------------------
# Copyright (c) Ensim Corporation 2000, 2001

# --------------------------------------------------------------------------

find /var/www/squirrelmail-attachments/ -type f -mtime +1 -exec rm -rf {} \;
> I think one of the sites are taking down the server!
Possibly - You have to scan all sites for their crons. The scripts You provided are nothing suspicious, hence running many such scripts concurrently will cause very high load average, and in fact I saw servers that under high LA stop responding. This can be the cause.
SabrinAuthor Commented:
is there a way to run each script from daily cron every 2 mins after each other ?
Cron does run it's jobs sequencially anyway.
But the job itself may go into background - then problem arises. Maybe the sites crons are run in parallel?
Duncan RoeSoftware DeveloperCommented:
run-parts is a shell script, so you could indeed modify it to kick off a job every 2 minutes.
Duncan RoeConnect With a Mentor Software DeveloperCommented:
"locate run-parts" to see where it is. I guess you are hoping to use the time of failure to identify which script is causing the problem. You can also modify run-parts to use the logger command to keep you informed of what it's doing.
When you say the server stops responding, do you mean it stops responding to network requests or is there no response at all from the console (no Alt-F6 if running X, no console echo, reset button or power cycle needed to reboot).
Perhaps Linux ran out of swap? Bad nfs connections can also give these symptoms. I'm inclined to think the 4am failure is too consistent to be hardware, but you never know.
Kerem ERSOYConnect With a Mentor PresidentCommented:
You may also add echo commands in your code and redirect output to a logfile:

cd /var/log
touch cronts

Run-parts is only a front-end it simply runs all the executable files  in a directory.

cd /etc/cron.daily

edit files and add something like this:

echo $(date +'%b  %e %R:%S') $(basename $0)  CP01 >> /var/log/cronts

before each line don't forget to replace the CP01 with some meaningful text. Dont for get to wrap text in ".." if it will have more than one word.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.