LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Start python application (MoinMoin) at startup / by running a script (https://www.linuxquestions.org/questions/linux-newbie-8/start-python-application-moinmoin-at-startup-by-running-a-script-890813/)

xbeck 07-09-2011 12:54 PM

Start python application (MoinMoin) at startup / by running a script
 
Dear all,

I have a personal copy of MoinMoin installed locally on my laptop running Ubuntu 10.04. I usually run the standalone server by changing to the dir where the moin.py resides and executing:

Code:

./moin.py server standalone
from the shell (bash). Now I would like to write a small script runmoin.sh. I have tried by

Code:

#!/bin/bash
./moin.py server standalone > /dev/null 2>&1 &

Interestingly, this works if I do

Code:

sh runmoin.sh
directly in that dir. However, if I create a link to this script (in /bin) and start if from anywhere,
I get this error message (I think from MoinMoin)

Code:

ConfigurationError

data_dir "data" does not exist, or has incorrect ownership or
permissions.

Make sure the directory and the subdirectory "pages" are owned by the web
server and are readable, writable and executable by the web server user
and group.

It is recommended to use absolute paths and not relative paths. Check
also the spelling of the directory name.

I don't have a clue how to fix this? Any suggestions or other options?

How would I automatically start the MoinMoin standalone directly after login?

Any help is greatly appreciated!

Thanks, xbeck.

grail 07-09-2011 01:12 PM

Have you tried using absolute paths instead of relative ones?

knudfl 07-09-2011 01:23 PM

Moin(-1.9.3) comes with a start script : moin-1.9.3/build/scripts-2.6/moin :

Code:

#! /usr/bin/python
#Fix and uncomment those 2 lines if your moin command doesn't find the MoinMoin package:
#import sys
#sys.path.insert(0, '/usr/lib/python/site-packages')
from MoinMoin.script.moin import run
run()

Start command example : moin server standalone

..

xbeck 07-09-2011 02:38 PM

Thanks for your replies!

grail: yes, I have used absolute paths, no difference: it works if I execute the script in the same directory (sh runmoin_fullpaths.sh), but if I make a link to the script and put this link in /bin, same 'Configuration' error

EDIT: even trying sh /full/path/to/script/runmoin.sh also gives 'Configuration' error.

knudfl: Interesting. But gives same error with 'Configuration' as above.

Apparently there is really a difference between executing the script / the command directly in the dir or running it from somewhere else?!

knudfl 07-09-2011 04:58 PM

cd moin-1.9.3/
# python setup.py install


which moin : The reply is : /usr/bin/moin
Meaning that you can run 'moin server standalone' from any location.

..

xbeck 07-09-2011 05:15 PM

Quote:

Originally Posted by knudfl (Post 4410176)
cd moin-1.9.3/
# python setup.py install


which moin : The reply is : /usr/bin/moin
Meaning that you can run 'moin server standalone' from any location.

..

Yes, okay. I renamed that /usr/bin/moin to be sure there is no conflict with my (modified) moin.py in my wiki dir. But that still does not explain why the script behaves differently between a) executing it directly in the dir, e.g. sh runmoin.sh and b) executing the exact same script from somewhere else, e.g. sh /path/to/script/runmoin.sh
The script just contains the two lines

Code:

#!/bin/bash
/path/to/wiki/moin.py server standalone  > /dev/null 2>&1 &

So I thought it does not matter from where I run it?

But it became clear that this is probably more related to MoinMoin, so I will ask there. Thanks!

grail 07-10-2011 01:28 AM

Well I am not sure what the issue might be, but an easy enough solution for your script is to put a cd into it so you are running from the location.


All times are GMT -5. The time now is 09:27 PM.