Help with Apache cgi

E

Ernest Ellingson

I'm trying to port a cgi program that runs fine under windows. But I
can't seem to get what I want done under linux.

I want to send out emails to a list of subscribers. This program will
take about 10 minutes to run.

In windows I've been using the start command. This actually starts a
process and the cgi program continues to run a tells the user that
emails are being sent. The start command lets the program run in the
background. The cgi program doesn't have to wait for the mail program
to finish.

I've tried
z=fork do
`mail progam`
end
Process.detatch(z)
The program doesn't run.
I've tried writing a cronjobs file
t=Time.now + 60
File.open('/var/www/cronjobs'){|f| f.write("#{t.min} #{t.hour} etc")}
`crontab /var/www/cronjobs`

crontab -u apache -l
lists the cron job at the right minute, hour, month, etc. but the cron
job doesn't run.

The only thing I've seen in the Rubytalk archives is a suggestion to
close stderr, stdin, and stdout in the child process when using fork.
That didn't help either.

Does anyone have a clue how to do this using apache and ruby?

Thanks in advance.

Ernie
 
E

Ernest Ellingson

Ernest said:
I'm trying to port a cgi program that runs fine under windows. But I
can't seem to get what I want done under linux.

I want to send out emails to a list of subscribers. This program will
take about 10 minutes to run.

In windows I've been using the start command. This actually starts a
process and the cgi program continues to run a tells the user that
emails are being sent. The start command lets the program run in the
background. The cgi program doesn't have to wait for the mail program
to finish.

I've tried
z=fork do
`mail progam`
end
Process.detatch(z)
The program doesn't run.
I've tried writing a cronjobs file
t=Time.now + 60
File.open('/var/www/cronjobs'){|f| f.write("#{t.min} #{t.hour} etc")}
`crontab /var/www/cronjobs`

crontab -u apache -l
lists the cron job at the right minute, hour, month, etc. but the
cron job doesn't run.

The only thing I've seen in the Rubytalk archives is a suggestion to
close stderr, stdin, and stdout in the child process when using fork.
That didn't help either.

Does anyone have a clue how to do this using apache and ruby?

Thanks in advance.

Ernie

I've figured it out.

Thanks to Thomas Uehlinger and the developers of daemons
http://daemons.rubyforge.org/
It's really simple!!!

Thanks again

Ernie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top