8 opendir(DIR, $config{'at_dir'});
9 while($f = readdir(DIR)) {
10 local $p = "$config{'at_dir'}/$f";
11 if ($f =~ /^(\d+)\.a$/) {
13 local $job = { 'id' => $f,
15 'user' => scalar(getpwuid($st[4])),
16 'created' => $st[9] };
22 $job->{'realcmd'} = $job->{'cmd'};
23 $job->{'realcmd'} =~ s/^[\000-\177]+#ident.*\ncd\s+\S+\nulimit\s+\S+\numask\s+\S+\n//;
31 # create_atjob(user, time, commands, directory, send-mail)
34 local @tm = localtime($_[1]);
35 local $date = strftime "%H:%M %b %d", @tm;
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, "su \"$_[0]\" -c \"cd $_[3] ; at $date\"");
52 &system_logged("at -r ".quotemeta($_[0]));