Using the 'at' command in a CGI script

This is on openSUSE-11.1 i586 if that matters. I have a CGI script written in bash which will create some file and spit out a webpage linking to that file. The script is run as user=wwwrun group=www by apache2. The file should be deleted after 2 minutes. The relevant part of the script looks like (simplified):

#!/bin/bash
#
echo "<h1>Hello world</h1>" > some-file.html
echo "rm -f some-file.html" | at now + 2 minutes
# some more code follows ...

I checked that wwwrun is not in /etc/at.deny and that no /etc/at.allow exists. However, the file is not deleted after 2 minutes. What is wrong here?

atd is running?

rcatd status

Even though you want the CGI script for its side effect, you still must output the correct HTML headers or the web server may decide that the script failed and return a 500 error to the browser. I think in this case the at command would have gone through first, but just to be on the safe sideā€¦

atd is running?

No :open_mouth:

~# rcatd status
Checking for at daemon: unused

@ken_yap: of course, the actual script is much bigger and issues the correct headers for apache.

Thank you all. After activating atd it works fine now. Stupid error from my side.