[Solution] disable proftpd and/or dovecot from being restarted by Virtualmin (collectinfo.pl)

11 posts / 0 new
Last post
#1 Mon, 10/11/2010 - 04:04
haydent

[Solution] disable proftpd and/or dovecot from being restarted by Virtualmin (collectinfo.pl)

Ok i finally sat down and followed the code from the collectinfo.pl cron job to the point it is restarted.

See i want to bee able to have the things available to me but off always, unless i toggle them from the system infomation > status page.

See i like the way the collectinfo.pl cron job restarts my services if they die, as it happens from time to time, but i dont need it restarting ftp and dovecot, as i have them disabled on boot and dont need them right now/always.

Also this free's system resources. BTW the switch to turn this collectinfo.pl script on / off and whether it restarts services is here: Virtualmin>System Settings>Virtualmin Configuration>Status Collection

Now onto the fix/hack. Youll be editing one of virtualmins perl libraries, but dont stress it can be done in notepad2 easily. first make a backup. its here:

/usr/share/webmin/virtual-server/collect-lib.pl

then open it up and go to line 636 this is the function "restart_collected_services" that restarts your services if they are down.

so we need to tell it to skip restarting the services we dont need. to do this i made a simple " if " statement around the restart code.

so in a blank line after the line " my $err; "

add this:

if(($ss->{'feature'} ne 'ftp') && ($ss->{'feature'} ne 'dovecot') ){#hayden - dont restart ftp or dovecot

then in a blank line before " $count++; "

add this:

} #hayden

explanation:

ne is string version of != or not equal this checks if the feature being checked is not ftp and not dovecot

if you want just one checked, modify the comparison.

Hayden.

Tue, 01/25/2011 - 18:00
haydent

[edit]

Tue, 01/25/2011 - 18:00
haydent

[edit]

Tue, 01/25/2011 - 18:01
haydent

[edit]

Tue, 01/25/2011 - 18:01
haydent

[edit]

Tue, 01/25/2011 - 18:02
haydent

[edit]

Tue, 01/25/2011 - 18:02
haydent

[edit]

Tue, 01/25/2011 - 18:02
haydent

[edit]

Tue, 01/25/2011 - 18:03
haydent

[edit]

Tue, 01/25/2011 - 18:03
haydent

see opening post for solution...

Sun, 05/15/2011 - 22:56
mikerobinson

Thank you haydent for the solution. However, I would actually consider this a great feature lacking from Virtualmin. In my opinion, it should do the following:

  • Get the settings of which services to restart from the system itself (e.g. from chkconfig) or if that's not possible at least have a list of services it restarts that are easily configurable either in Virtualmin or Webmin.

  • Log all services restarted and have this emailed to the administrator. It would probably be good for the administrator to know if one or more of the services were constantly failing and need restarting.

Topic locked