简体   繁体   中英

Where I should put my python scripts in Linux?

My python program consists of several files:

  • the main execution python script
  • python modules in *.py files
  • config file
  • log files
  • executables scripts of other languages.

All this files should be available only for root. The main script should run on startup, eg via upstart.
Where I should put all this files in Linux filesystem?
What's the better way for distribution my program? pip, easy_install, deb, ...? I haven't worked with any of these tool, so I want something easy for me. The minimum supported Linux distributive should be Ubuntu.

For sure, if this program is to be available only for root , then the main execution python script have to go to /usr/sbin/ .

Config files ought to go to /etc/ , and log files to /var/log/ .

Other python files should be deployed to /usr/share/pyshared/ .

Executable scripts of other languages will go either in /usr/bin/ or /usr/sbin/ depending on whether they should be available to all users, or for root only.

If only root should access the scripts, why not put it in /root/ ? Secondly, if you're going to distribute your application you'll probably need easy_install or something similar, otherwise just tar.gz the stuff if only a few people will access it?

It all depends on your scale.. Pyglet, wxPython and similar have a hughe userbase.. same for BeautifulSoup but they still tar.gz the stuff and you just use setuptools to deply it (whcih, is another option).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM