Apache nightly restart

connectedstream

New member
Joined
Sep 3, 2007
Messages
4
Has anyone any idea how to disable DA from restarting apache nightly as this also restarts a exec script i have running.

Ive searched the forums and tried several things but nothing seems to stop it all together.

1st of all i changed the conf so the username would be nobody instead of apache.. didint work.

so i edited /usr/local/directadmin/data/admin/service.status to httpd=OFF worked for 1 night then direct admin must of rewrote the file.

So either i can stop DA from writing to that file so service monitor can not rewrite or i can do what i am doing now which is ive delted the /etc/init.d/httpd file so nothing can restart apache, obviously not the best way but a temp solution untill i can stop DA from restarting every night.

Code:
DA errortaskq
2007:07:24-14:15:03: cmd: /etc/init.d/named reload                           >>/dev/null 2>>/dev/null           
2007:07:24-14:15:03: cmd: /etc/init.d/proftpd reread                           >>/dev/null 2>>/dev/null           
2007:07:24-14:23:02: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:07:24-14:23:02: cmd: /etc/init.d/named reload                           >>/dev/null 2>>/dev/null           
2007:07:24-14:23:02: cmd: /etc/init.d/proftpd reread                           >>/dev/null 2>>/dev/null           
2007:07:25-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:07:26-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:07:27-00:12:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:07:29-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:07:31-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:08:01-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:08:01-04:20:01: Reset All has started
2007:08:01-04:20:01: Reset All has finished
2007:08:01-04:22:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:08:04-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:08:05-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:08:06-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:08:07-00:12:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:08:08-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:08:09-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:08:10-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:08:11-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:08:12-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:08:13-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:08:14-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:08:16-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:08:17-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:08:18-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:08:19-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:08:20-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:08:21-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:08:22-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:08:23-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:08:24-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:08:25-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:08:27-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:08:28-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:08:28-16:14:01: cmd: /etc/init.d/directadmin restart                           >>/dev/null 2>>/dev/null           
2007:08:30-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:08:30-16:07:01: cmd: /etc/init.d/directadmin restart                           >>/dev/null 2>>/dev/null           
2007:08:31-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:09:01-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:09:01-04:20:01: Reset All has started
2007:09:01-04:20:02: Reset All has finished
2007:09:01-04:22:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:09:02-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:09:03-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:09:03-00:11:01: Error restarting service httpd : uid 0 gid 0 : /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:09:04-00:11:01: cmd: /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null           
2007:09:04-00:11:02: Error restarting service httpd : uid 0 gid 0 : /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null


Code:
httpd error log

sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
mpg123: Can't rewind stream by 36 bits!
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
[Tue Sep  4 00:10:02 2007] [notice] SIGHUP received.  Attempting to restart
[Tue Sep  4 00:10:03 2007] [notice] Apache/1.3.37 (Unix) mod_ssl/2.8.28 OpenSSL/0.9.7e PHP/4.4.4 FrontPage/5.0.2.2510 configured -- resuming normal operations
[Tue Sep  4 00:10:03 2007] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Sep  4 00:10:03 2007] [notice] Accept mutex: sysvsem (Default: sysvsem)
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
sh: line 1: host: command not found
mpg123: Can't rewind stream by 9 bits!
kill: usage: kill [-s sigspec | -n signum | -sigspec] [pid | job]... or kill -l [sigspec]
mpg123: Can't rewind stream by 33 bits!

Any help would be apreciated thankyou.
 
Last edited:
This is bugging me too - Everytime DA restarts Apache it kills off a couple of process which Apache started and which I need to keep running - It's getting to be a pain to have to restart them manually every day
 
When DirectAdmin restarts apache it kills all the httpd processes and restarts the main process according to the default DirectAdmin configuration. What else is it not doing for you that needs to be done? Please be specific as posible.

Jeff
 
We have users who start Python processes via a web interface to a set of PHP scripts - Each process uses different command-line arguments which are generated by the scripts and passed to the processes when they are launched - When DA restarts Apache all the currently-running processes get killed

So I guess the answer to what isn't it doing is that it's not restarting those Python processes - And even if it did somehow manage to do that automatically would it be able to pass the correct arguments to each one given that they aren't recorded when the process is originally launched?

The processes are also stopped using the same interface as is used to start them - So even if DA/Apache did somehow manage to restart them correctly would it then be possible to kill them when desired from the new instance of Apache?

Is there a way to stop DA automatically restarting Apache every night?

And is there a reason for restarting Apache as a matter of course every day/night?

Lots of questions - Sorry! But I'd really like to get this sorted out somehow

~Kitty~
 
Now I understand :) .

I don't think there's an easy workaround because in a shared environment there are several reasons why apache may need to be restarted.

Is apache restarted when domains are added? When they're removed? I'm not sure.

But I know that apache is restarted when logs are rotated. This is a required part of logrotation.

Jeff
 
Is there a way to stop DA automatically restarting Apache every night?

And is there a reason for restarting Apache as a matter of course every day/night?

~Kitty~

Ive tried everything i can think of and none of its working.Even deleting the httpd file doesnt work, its driving me mad , there must be a way to stop DA from restarting Apache every night. Anyone else got any ideas??
 
Ive commented out the directadmin_cron in etc/cron.d/directadmin_cron
and usr/local/directadmin/scripts and restarted hopefully this will work for me but for this is going to be a problem for shared hosting as it will disable log rotation etc aswell.

Will let you know if this works tonight and repost tomorrow.
 
You've no doubt broken a lot of other DirectAdmin functionality as well.

Breaking log rotation (which is in /etc/cron.daily, and not in the directadmin cron) would make your logs unmanageable quickly, and end up filling your hard disk at some point. Perhaps you can move it from cron.daily to cron.weekly or cron.monthly if you have enough disk space and don't ever need to look at your logs once they become unmanageably large.

You've broken DirectAdmin's ability to do just about eveything done by the task queue, including it's ability to add or delete domains. It'll show them as deleted or added but it'll never change the state of the httpd.conf files, which means they won't be added or deleted.

You might want to bring up your issue on an apache forum somewhere; maybe there's a way to keep track of what's been started, and to restart it when apache is restarted, or to keep it from stopping when apache is stopped in the first place.

I don't think you're going to be able to live with the option of breaking so much of DirectAdmin's functionality.

Certainly every time you'll ask us a question that's related to DirectAdmin's runtime environment we're just going to tell you that you broke DirectAdmin when you removed it's ability to run it's task queue.

And since one of the things yo've broken is DirectAdmin's ability to check it's license, it will probably stop working completely, soon.

Jeff
 
You've no doubt broken a lot of other DirectAdmin functionality as well.

Breaking log rotation (which is in /etc/cron.daily, and not in the directadmin cron) would make your logs unmanageable quickly, and end up filling your hard disk at some point. Perhaps you can move it from cron.daily to cron.weekly or cron.monthly if you have enough disk space and don't ever need to look at your logs once they become unmanageably large.

And since one of the things yo've broken is DirectAdmin's ability to check it's license, it will probably stop working completely, soon.

Jeff

This is true and would definatly not be good for shared hosting.
I did try this yesterday and it did stop Apache restarting.

Im going to try just commented out the talley line tonight see if that will stop the apache restart without effecting to much of the DA tasks.

Code:
* * * * * root /usr/local/directadmin/dataskq
2 0-23/6 * * * root echo 'action=vacation&value=all' >> /usr/local/directadmin/data/task.queue;
5 5 * * 0 root /sbin/quotaoff -a; /sbin/quotacheck -augm; /sbin/quotaon -a;
#10 0 * * * root echo 'action=tally&value=all' >> /usr/local/directadmin/data/task.queue
20 4 1 * * root echo 'action=reset&value=all' >> /usr/local/directadmin/data/task.queue
0 4 * * * root echo 'action=check&value=license' >> /usr/local/directadmin/data/task.queue

I will try this tonight and post my results tomorrow.

You might want to bring up your issue on an apache forum somewhere; maybe there's a way to keep track of what's been started, and to restart it when apache is restarted, or to keep it from stopping when apache is stopped in the first place.

Think that would be the best way, not sure how hard that would be to implement, will have a look around see what i can find.
 
I don't think that's going to help because the logrotate command restarts apache.

The line that does it in my /etc/logrotate.d/apache file is line 5, the one that begins with /bin/kill. Note that if you remove it, or comment it out, the logrotate system will rename the logs as if they were being rotated, but the old log will continue to get larger (even after four weeks when it appears to be deleted) and your system won't write to the new logs.

Jeff
 
I don't think that's going to help because the logrotate command restarts apache.

The line that does it in my /etc/logrotate.d/apache file is line 5, the one that begins with /bin/kill. Note that if you remove it, or comment it out, the logrotate system will rename the logs as if they were being rotated, but the old log will continue to get larger (even after four weeks when it appears to be deleted) and your system won't write to the new logs.

Jeff

the logrotate doesn't need the restart , it can do it on a reload command or a graceful restart also.

I had this same problem and the python forum told me to change the restart to a reload,

I did contact DA support and they gave me this.

Code:
You'd need to edit

nano /etc/init.d/httpd

In the "restart)" section, change:
 
  restart)
        stop
        waitforexit "httpd" 20
        start
        ;;
to:
 
  restart)
        kill -USR1 `cat /var/run/httpd.pid`
        ;;

Seems to be working for me and the logs are being deleted.

I will watch this and let you know.

the python people told me to make it

Code:
restart)
        reload
        ;;

but im going with DA's response first.
 
Actually both the DA method and the python method do a reload every time you call a restart.

So what happens when you really need a restart?

Jeff
 
Back
Top