0

I have written a script that checks out some files from a repository, operates on them in some way and produces a result file in html.

I would like all users to be able to run the script and view the results independently. This includes one user running the script and another viewing the results.

From my limited understanding of the Unix folder structure I believe I should put the script itself in /usr/local/bin.

My question is where should I put the files that are checked out from the repo and the results? Should they go in sub-folders of /usr/local, and if so, is there a standard practice I should be following? Or should I put them somewhere else entirely?

ksl
  • 4,519
  • 11
  • 65
  • 106
  • 1
    Definitely not `/usr/local`. I would go for creating a folder off `/tmp` and using that - unless you want the files to be retained across reboots, in which case consider `/var/tmp` – Mark Setchell Dec 30 '14 at 16:53

2 Answers2

0

My question is where should I put the files that are checked out from the repo and the results? Should they go in sub-folders of /usr/local, and if so, is there a standard practice I should be following? Or should I put them somewhere else entirely?

/usr/local is poor choice as only root has write permissions there. Most utilities place result files in current working directory by default or in place specified in command line. Temporary files should be placed in /tmp. mktemp utility can be handy.

  • If the script places the result files in the cwd then only that user can see them. Is there a default directory that is visible to all users by default? – ksl Dec 30 '14 at 11:24
0

/usr/local is a poor choice for your temp files as indicated by the others.

You may choose to put the script under the /usr/local/bin, but do not extract or process your files under /usr/local.

You can probably choose /tmp or a separate folder under the the user's home directory (example: /home/username/appname) to place those files instead.

Hope this helps.

anacron
  • 6,443
  • 2
  • 26
  • 31