6 opendir(DIR, $config{'at_dir'});
7 while($f = readdir(DIR)) {
8 local $p = "$config{'at_dir'}/$f";
9 if ($f =~ /^a(\S{5})(\S+)$/) {
11 local $job = { 'id' => hex($1),
12 'date' => hex($2) * 60,
13 'user' => scalar(getpwuid($st[4])),
14 'created' => $st[9] };
20 $job->{'realcmd'} = $job->{'cmd'};
21 $job->{'realcmd'} =~ s/^[\000-\177]+cd\s+(\S+)\s+\|\|\s+{\n.*\n.*\n.*\n//;
22 $job->{'realcmd'} =~ s/\$\{SHELL:.*\n\n?//;
30 # create_atjob(user, time, commands, directory, send-email)
33 local @tm = localtime($_[1]);
34 local $date = sprintf "%2.2d:%2.2d %d.%d.%d",
35 $tm[2], $tm[1], $tm[3], $tm[4]+1, $tm[5]+1900;
36 local $mailflag = $_[4] ? "-m" : "";
37 local $cmd = "cd ".quotemeta($_[3])." ; at $mailflag $date";
38 local @uinfo = getpwnam($_[0]);
39 if ($uinfo[2] != $<) {
40 # Only SU if we are not already the user
41 $cmd = &command_as_user($_[0], 0, $cmd);
43 &open_execute_command(AT, "$cmd >/dev/null 2>&1", 0);
46 &additional_log('exec', undef, $cmd);
52 &system_logged("atrm ".quotemeta($_[0])." >/dev/null 2>&1");