2008-08-18 60 views

回答

31

我得到的信息:

/usr/local/sbin  custom script meant for root 
/usr/local/bin  custom script meant for all users including non-root 

chatlog從irc.debian剪。組織#debian:

(02:48:49) c33s: question: where is the _correct_ location, to put custom scripts 
for the root user (like a script on a webserver for createing everything needed 
for a new webuser)? is it /bin, /usr/local/bin,...? /usr/local/scripts is 
mentioned in (*link to this page*) 
(02:49:15) Hydroxide: c33s: typically /usr/local/sbin 
(02:49:27) Hydroxide: c33s: no idea what /usr/local/scripts would be 
(02:49:32) Hydroxide: it's nonstandard 
(02:49:53) Hydroxide: if it's a custom script meant for all users including 
non-root, then /usr/local/bin 
(02:52:43) Hydroxide: c33s: Debian follows the Filesystem Hierarchy Standard, 
with a very small number of exceptions, which is online in several formats at 
http://www.pathname.com/fhs/ (also linked from http://www.debian.org/devel/ and 
separately online at http://www.debian.org/doc/packaging-manuals/fhs/fhs-2.3.html) 
(02:53:03) Hydroxide: c33s: if you have the debian-policy package installed, it's 
also in several formats at /usr/share/doc/debian-policy/fhs/ on your system 
(02:53:37) Hydroxide: c33s: most linux distributions follow that standard, though 
usually less strictly and with more deviations than Debian. 

要感謝氫氧化

+0

啊,好極了!謝謝! – 2011-11-03 02:23:15

19

如果你談論的是通過將用戶的crontab來運行用戶創建的腳本,我通常把那些在任何一個箱子或腳本在主目錄文件夾,或者如果他們打算共享用戶,/ usr/local/scripts目錄。

3

我強烈beleiver,如果一個文件被用戶做出,它會在他的用戶目錄(/ home /用戶名),如果他沒有做它那麼它變得更爲複雜。我過去只是將它們放在/ usr/local/bin,/ bin或/ usr/local/scripts中,我不確定關於etch,但是您需要檢查以確保/ usr/local /腳本實際上是在Cron的$ PATH中。

2

/home/username/bin怎麼樣?

將〜/ bin添加到$ PATH,並使腳本可執行chmod + x filename。

2

我個人更喜歡

/home/username/.bin 

這樣bin文件夾是隱藏的,但你仍然可以將其添加到PATH和執行與x位內的所有腳本。

我喜歡我的主目錄很乾淨(乍一看)很少的文件夾。

8

對於它感興趣的人,Filesystem Hierarchy Standard (FHS)是一個標準文件,仍然是一個很好的閱讀。我描述了幾乎任何Linux發行版的基礎,並且正式獲得批准,例如通過Debian和Linux標準基礎(LSB)。

但是,您不會爲這個問題找到任何肯定的答案,因爲......它沒有被定義;-)。唯一可以說的是:不要放入/ bin(不在/ usr/bin中)。/usr/local /腳本也不常見。 $ HOME/bin似乎是一個可接受的地方,如果腳本只被這個單用戶使用。

3

Debian guide是非常有用的,當涉及到Ubuntu:

通常情況下,程序安裝自己在/ usr/local子目錄。但是,Debian軟件包絕對不能使用那個目錄,因爲它被保留給系統管理員(或用戶)的私人使用

/usr/local/bin似乎根據指導是可以接受的。

我個人將我的腳本放在$HOME/.scripts

我希望LSB能專門解決這個問題。