I am working on a passenger app that saves the output of a terminal command to a file on /scratch
. Basically, I run the command + > ~/scratch/$USER/output.txt
if a button is pressed on the app. I can run that command within the directory of app, but it doesn’t work when I click the button on the running app (though it does when I run the app locally). What could be going on here?
Many thanks in advance
I would maybe have to see more of how you’re invoking the command. It’s maybe an issue with the CWD (current working directory). The CWD of a passenger app is /var/www/ood/apps/sys/theappname
(or similar, it’s the location of the files themsevles, that example was for a system installed app).
If you can share the entire codebase I can take a look too. I re-read that and see you say I can run that command within the directory of app
so there could be something else going on here.
When you redirect output like that, that’s only stdout. Maybe there’s some stderr that could indicate something?
Yes, absolutely. Here is the repo:
Just at a glance, I’m wondering if $USER
is being evaluated correctly. If you use the etc
library is it any different?
require 'etc'
username = Etc.getlogin
output, error = command.exec("find /scratch/#{username} -type f -atime +90 -ctime +90 -mtime +90 -print > ~/scratch/#{username}/output.txt")
I get the same issue. I am pretty sure it has something to do with how the post/get requests are being handled. I’ll keep working on it and let you know if I figure it out.
yes it likely is.
Instaed of the action being /
- it should have the /pun/sys/appname
prefix.
Sinatra takes this prefix into account and has a helper method called url
.
<form action="<%= url('/') %>" method="get">
You were right! It just came down to the routes.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.