Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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, e.g. 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.

like image 611
George Avatar asked May 15 '13 12:05

George


2 Answers

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.

like image 81
Didier Trosset Avatar answered Nov 11 '22 18:11

Didier Trosset


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).

like image 45
Torxed Avatar answered Nov 11 '22 18:11

Torxed