Hi, well here comes my problem. I''m working on a function that will generate PDF files automatically using files already existing. I''m using pdftk utils to generate those files and everythings is working just fine when testing in localhost on my laptop (I''m running windows vista on it). But when I come to deploy the application on my server (unix of course) and test the function, nothing occurs, seems that the function is not executed (I don''t even have a error message...). here comes the code for the execution of the function: # Merging front page and PDF system("#{RAILS_ROOT}/public/products/pdftk #{RAILS_ROOT}/public/ orders/order#{order.id}/products/frontPage#{product.id}.pdf # {RAILS_ROOT}/public/products/#{formatedProductName}.pdf cat output # {RAILS_ROOT}/public/orders/order#{params[:id]}/products/finalPDF# {product.id}.pdf") while !File.exist?("#{RAILS_ROOT}/public/orders/order#{params[:id]}/ products/finalPDF#{product.id}.pdf") # We wait... end RAILS_DEFAULT_LOGGER.info("\n\n#{RAILS_ROOT}/public/orders/order# {params[:id]}/products/finalPDF#{product.id}.pdf created\n") # Generating password protected PDF system("#{RAILS_ROOT}/public/products/pdftk #{RAILS_ROOT}/public/ orders/order#{params[:id]}/products/finalPDF#{product.id}.pdf output # {RAILS_ROOT}/public/orders/order#{params[:id]}/products/# {formatedProductName}_#{params[:firstname].tr(''\'''','''')}_#{params [:lastname].tr(''\'''','''')}.pdf owner_pw #{adminAccessPassword} user_pw # {customerAccessPassword}") while !File.exist?("#{RAILS_ROOT}/public/orders/order#{params[:id]}/ products/#{formatedProductName}_#{params[:firstname].tr(''\'''','''')}_# {params[:lastname].tr(''\'''','''')}.pdf") # We wait... end The files and paths are correct, I verified several times. pdftk is correctly installed on the server (I tested executing those two commands manualy on the server, it worked perfectly and I could get the files generated). It''s pretty urgent, I''ve tested changing "system" for backquotes and nothing. Any idea would be welcome ^^? Olivier.
What user is your Rails app running as on the server? That would be my first suspect... --Matt Jones On May 20, 3:47 pm, CiriusMex <cirius...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, well here comes my problem. I''m working on a function that will > generate PDF files automatically using files already existing. I''m > using pdftk utils to generate those files and everythings is working > just fine when testing in localhost on my laptop (I''m running windows > vista on it). But when I come to deploy the application on my server > (unix of course) and test the function, nothing occurs, seems that the > function is not executed (I don''t even have a error message...). here > comes the code for the execution of the function: > > # Merging front page and PDF > system("#{RAILS_ROOT}/public/products/pdftk #{RAILS_ROOT}/public/ > orders/order#{order.id}/products/frontPage#{product.id}.pdf # > {RAILS_ROOT}/public/products/#{formatedProductName}.pdf cat output # > {RAILS_ROOT}/public/orders/order#{params[:id]}/products/finalPDF# > {product.id}.pdf") > > while !File.exist?("#{RAILS_ROOT}/public/orders/order#{params[:id]}/ > products/finalPDF#{product.id}.pdf") > # We wait... > end > > RAILS_DEFAULT_LOGGER.info("\n\n#{RAILS_ROOT}/public/orders/order# > {params[:id]}/products/finalPDF#{product.id}.pdf created\n") > > # Generating password protected PDF > system("#{RAILS_ROOT}/public/products/pdftk #{RAILS_ROOT}/public/ > orders/order#{params[:id]}/products/finalPDF#{product.id}.pdf output # > {RAILS_ROOT}/public/orders/order#{params[:id]}/products/# > {formatedProductName}_#{params[:firstname].tr(''\'''','''')}_#{params > [:lastname].tr(''\'''','''')}.pdf owner_pw #{adminAccessPassword} user_pw # > {customerAccessPassword}") > > while !File.exist?("#{RAILS_ROOT}/public/orders/order#{params[:id]}/ > products/#{formatedProductName}_#{params[:firstname].tr(''\'''','''')}_# > {params[:lastname].tr(''\'''','''')}.pdf") > # We wait... > end > > The files and paths are correct, I verified several times. pdftk is > correctly installed on the server (I tested executing those two > commands manualy on the server, it worked perfectly and I could get > the files generated). > > It''s pretty urgent, I''ve tested changing "system" for backquotes and > nothing. Any idea would be welcome ^^? > > Olivier.
try piping it to STDOUT see if you get anywhere. Ex: sh.system("ls", "-l") | sh.head > STDOUT On Thu, May 21, 2009 at 3:31 PM, Matt Jones <al2o3cr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > What user is your Rails app running as on the server? That would be my > first suspect... > > --Matt Jones > > On May 20, 3:47 pm, CiriusMex <cirius...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> Hi, well here comes my problem. I''m working on a function that will >> generate PDF files automatically using files already existing. I''m >> using pdftk utils to generate those files and everythings is working >> just fine when testing in localhost on my laptop (I''m running windows >> vista on it). But when I come to deploy the application on my server >> (unix of course) and test the function, nothing occurs, seems that the >> function is not executed (I don''t even have a error message...). here >> comes the code for the execution of the function: >> >> # Merging front page and PDF >> system("#{RAILS_ROOT}/public/products/pdftk #{RAILS_ROOT}/public/ >> orders/order#{order.id}/products/frontPage#{product.id}.pdf # >> {RAILS_ROOT}/public/products/#{formatedProductName}.pdf cat output # >> {RAILS_ROOT}/public/orders/order#{params[:id]}/products/finalPDF# >> {product.id}.pdf") >> >> while !File.exist?("#{RAILS_ROOT}/public/orders/order#{params[:id]}/ >> products/finalPDF#{product.id}.pdf") >> # We wait... >> end >> >> RAILS_DEFAULT_LOGGER.info("\n\n#{RAILS_ROOT}/public/orders/order# >> {params[:id]}/products/finalPDF#{product.id}.pdf created\n") >> >> # Generating password protected PDF >> system("#{RAILS_ROOT}/public/products/pdftk #{RAILS_ROOT}/public/ >> orders/order#{params[:id]}/products/finalPDF#{product.id}.pdf output # >> {RAILS_ROOT}/public/orders/order#{params[:id]}/products/# >> {formatedProductName}_#{params[:firstname].tr(''\'''','''')}_#{params >> [:lastname].tr(''\'''','''')}.pdf owner_pw #{adminAccessPassword} user_pw # >> {customerAccessPassword}") >> >> while !File.exist?("#{RAILS_ROOT}/public/orders/order#{params[:id]}/ >> products/#{formatedProductName}_#{params[:firstname].tr(''\'''','''')}_# >> {params[:lastname].tr(''\'''','''')}.pdf") >> # We wait... >> end >> >> The files and paths are correct, I verified several times. pdftk is >> correctly installed on the server (I tested executing those two >> commands manualy on the server, it worked perfectly and I could get >> the files generated). >> >> It''s pretty urgent, I''ve tested changing "system" for backquotes and >> nothing. Any idea would be welcome ^^? >> >> Olivier. > > >
Ok, thanks for the help, I changed the path for the system command execution and did the trick, I don''t really know what was the problem but hope it won''t come back...^^ Anyway, thanks for taking time to respond to my question ;) Olivier. On 21 mayo, 14:44, Michael Steinfeld <mikeisgr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> try piping it to STDOUT see if you get anywhere. Ex: > sh.system("ls", "-l") | sh.head > STDOUT > > > > On Thu, May 21, 2009 at 3:31 PM, Matt Jones <al2o...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > What user is your Rails app running as on the server? That would be my > > first suspect... > > > --Matt Jones > > > On May 20, 3:47 pm, CiriusMex <cirius...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> Hi, well here comes my problem. I''m working on a function that will > >> generate PDF files automatically using files already existing. I''m > >> using pdftk utils to generate those files and everythings is working > >> just fine when testing in localhost on my laptop (I''m running windows > >> vista on it). But when I come to deploy the application on my server > >> (unix of course) and test the function, nothing occurs, seems that the > >> function is not executed (I don''t even have a error message...). here > >> comes the code for the execution of the function: > > >> # Merging front page and PDF > >> system("#{RAILS_ROOT}/public/products/pdftk #{RAILS_ROOT}/public/ > >> orders/order#{order.id}/products/frontPage#{product.id}.pdf # > >> {RAILS_ROOT}/public/products/#{formatedProductName}.pdf cat output # > >> {RAILS_ROOT}/public/orders/order#{params[:id]}/products/finalPDF# > >> {product.id}.pdf") > > >> while !File.exist?("#{RAILS_ROOT}/public/orders/order#{params[:id]}/ > >> products/finalPDF#{product.id}.pdf") > >> # We wait... > >> end > > >> RAILS_DEFAULT_LOGGER.info("\n\n#{RAILS_ROOT}/public/orders/order# > >> {params[:id]}/products/finalPDF#{product.id}.pdf created\n") > > >> # Generating password protected PDF > >> system("#{RAILS_ROOT}/public/products/pdftk #{RAILS_ROOT}/public/ > >> orders/order#{params[:id]}/products/finalPDF#{product.id}.pdf output # > >> {RAILS_ROOT}/public/orders/order#{params[:id]}/products/# > >> {formatedProductName}_#{params[:firstname].tr(''\'''','''')}_#{params > >> [:lastname].tr(''\'''','''')}.pdf owner_pw #{adminAccessPassword} user_pw # > >> {customerAccessPassword}") > > >> while !File.exist?("#{RAILS_ROOT}/public/orders/order#{params[:id]}/ > >> products/#{formatedProductName}_#{params[:firstname].tr(''\'''','''')}_# > >> {params[:lastname].tr(''\'''','''')}.pdf") > >> # We wait... > >> end > > >> The files and paths are correct, I verified several times. pdftk is > >> correctly installed on the server (I tested executing those two > >> commands manualy on the server, it worked perfectly and I could get > >> the files generated). > > >> It''s pretty urgent, I''ve tested changing "system" for backquotes and > >> nothing. Any idea would be welcome ^^? > > >> Olivier.- Ocultar texto de la cita - > > - Mostrar texto de la cita -