Skip to content
Snippets Groups Projects
Commit 1f9b418c authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Don't open the mail base until/unless you need to send a message.

parent 85c57e8e
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #212 passed
...@@ -20,12 +20,7 @@ for(i=0;i<argc;i++) ...@@ -20,12 +20,7 @@ for(i=0;i<argc;i++)
if(!dirs.length) if(!dirs.length)
dirs.push(system.temp_dir); // default to temp dir if none specified dirs.push(system.temp_dir); // default to temp dir if none specified
msgbase = new MsgBase("mail"); var msgbase;
if(msgbase.open()==false) {
log(LOG_ERR,"!ERROR " + msgbase.last_error);
exit();
}
for(i in dirs) { for(i in dirs) {
var freespace = dir_freespace(dirs[i],1024); var freespace = dir_freespace(dirs[i],1024);
...@@ -33,6 +28,13 @@ for(i in dirs) { ...@@ -33,6 +28,13 @@ for(i in dirs) {
if(freespace==-1 || freespace >= minspace) if(freespace==-1 || freespace >= minspace)
continue; // everything's fine continue; // everything's fine
if(!msgbase) {
msgbase = new MsgBase("mail");
if(msgbase.open()==false) {
log(LOG_ERR,"!ERROR " + msgbase.last_error);
exit();
}
}
log(LOG_WARNING,"!Low disk space: " + freespace + " kilobytes on " + dirs[i]); log(LOG_WARNING,"!Low disk space: " + freespace + " kilobytes on " + dirs[i]);
hdr = { to: 'sysop', to_ext: '1', from: 'chkspace', subject: 'Low disk space notification' } hdr = { to: 'sysop', to_ext: '1', from: 'chkspace', subject: 'Low disk space notification' }
...@@ -44,4 +46,5 @@ for(i in dirs) { ...@@ -44,4 +46,5 @@ for(i in dirs) {
log(LOG_INFO,"E-mailed low disk space notification to sysop"); log(LOG_INFO,"E-mailed low disk space notification to sysop");
} }
if(msgbase)
msgbase.close(); msgbase.close();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment