...
 
Commits (1)
......@@ -20,12 +20,7 @@ for(i=0;i<argc;i++)
if(!dirs.length)
dirs.push(system.temp_dir); // default to temp dir if none specified
msgbase = new MsgBase("mail");
if(msgbase.open()==false) {
log(LOG_ERR,"!ERROR " + msgbase.last_error);
exit();
}
var msgbase;
for(i in dirs) {
var freespace = dir_freespace(dirs[i],1024);
......@@ -33,6 +28,13 @@ for(i in dirs) {
if(freespace==-1 || freespace >= minspace)
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]);
hdr = { to: 'sysop', to_ext: '1', from: 'chkspace', subject: 'Low disk space notification' }
......@@ -44,4 +46,5 @@ for(i in dirs) {
log(LOG_INFO,"E-mailed low disk space notification to sysop");
}
msgbase.close();
\ No newline at end of file
if(msgbase)
msgbase.close();