Subversion Repositories wimsdev

Rev

Rev 10 | Rev 8155 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 10 Rev 7673
Line 13... Line 13...
13
 *  You should have received a copy of the GNU General Public License
13
 *  You should have received a copy of the GNU General Public License
14
 *  along with this program; if not, write to the Free Software
14
 *  along with this program; if not, write to the Free Software
15
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
15
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16
 */
16
 */
17
 
17
 
18
        /* Only miscellaneous cleanup routines remain.
18
/* Only miscellaneous cleanup routines remain.
19
         * The regular session cleaner has been moved to wimslogd. */
19
 * The regular session cleaner has been moved to wimslogd. */
20
 
20
 
21
void cleantmpdir(void)
21
void cleantmpdir(void)
22
{
22
{
23
    char buf[MAX_LINELEN+1], *p1, *p2;
23
    char buf[MAX_LINELEN+1], *p1, *p2;
24
   
24
 
25
    accessfile(buf,"r","%s/exec.pid",tmp_dir);
25
    accessfile(buf,"r","%s/exec.pid",tmp_dir);
26
    for(p1=find_word_start(buf); *p1; p1=find_word_start(p2)) {
26
    for(p1=find_word_start(buf); *p1; p1=find_word_start(p2)) {
27
        p2=find_word_end(p1); if(*p2) *p2++=0;
27
     p2=find_word_end(p1); if(*p2) *p2++=0;
28
        kill(atoi(p1),SIGKILL);
28
     kill(atoi(p1),SIGKILL);
29
    }
29
    }
30
    if(strstr(tmp_dir,"sessions/")!=NULL &&
30
    if(strstr(tmp_dir,"sessions/")!=NULL &&
31
       (strstr(tmp_debug,"yes")==NULL || checkhost(manager_site)<1)) {
31
       (strstr(tmp_debug,"yes")==NULL || checkhost(manager_site)<1)) {
32
        if(remove_tree(tmp_dir)) {
32
     if(remove_tree(tmp_dir)) {
33
            call_ssh("bin/ch..root cleantmpdir 2>/dev/null");
33
         call_ssh("bin/ch..root cleantmpdir 2>/dev/null");
34
            remove_tree(tmp_dir);
34
         remove_tree(tmp_dir);
35
        }
35
     }
36
    }
36
    }
37
    else {
37
    else {
38
        mkfname(buf,"%s/exec.pid",tmp_dir);
38
     mkfname(buf,"%s/exec.pid",tmp_dir);
39
        unlink(buf);
39
     unlink(buf);
40
        if(strstr(tmp_dir,"sessions/")!=NULL) {
40
     if(strstr(tmp_dir,"sessions/")!=NULL) {
41
            chmod(tmp_dir,S_IRUSR|S_IWUSR|S_IXUSR);
41
         chmod(tmp_dir,S_IRUSR|S_IWUSR|S_IXUSR);
42
        }
42
     }
43
    }
43
    }
44
}
44
}
45
 
45
 
46
        /* remove pid tag */
46
/* remove pid tag */
47
void delete_pid(void)
47
void delete_pid(void)
48
{
48
{
49
    char buf[MAX_FNAME+1],pbuf[32];
49
    char buf[MAX_FNAME+1],pbuf[32];
50
 
50
 
51
    flushlog(); flushoutput();
51
    flushlog(); flushoutput();