Mercurial > libervia-backend
comparison src/sat.sh @ 369:e83d0c21d64d
launching script now read config files
added ./sat.conf in possible config file location
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 19 Jun 2011 17:40:36 +0200 |
parents | f147b778511a |
children | ac568832a71a |
comparison
equal
deleted
inserted
replaced
368:d9499d27f884 | 369:e83d0c21d64d |
---|---|
14 fi | 14 fi |
15 fi | 15 fi |
16 | 16 |
17 NAME='sat' | 17 NAME='sat' |
18 | 18 |
19 if [ -n "$SAT_CONST_local_dir" ];then | 19 #We use python to parse config files |
20 echo "Using overidded local dir: $SAT_CONST_local_dir" | 20 eval `python<<PYTHONEND |
21 PID_FILE="$SAT_CONST_local_dir/$NAME.pid" | 21 from ConfigParser import SafeConfigParser |
22 LOG_FILE="$SAT_CONST_local_dir/$NAME.log" | 22 from os.path import expanduser, join |
23 else | 23 |
24 PID_FILE="/tmp/$NAME.pid" | 24 config = SafeConfigParser(defaults={'local_dir':'~/.sat', |
25 LOG_FILE=~/".$NAME/$NAME.log" | 25 'pid_dir':'/tmp', |
26 fi | 26 'log_dir':'%(local_dir)s'}) |
27 try: | |
28 config.read(map(expanduser, ['/etc/sat.conf', '~/sat.conf', '~/.sat.conf', 'sat.conf', '.sat.conf'])) | |
29 except: | |
30 print ("Can't read main config !") | |
31 print "LOCAL_DIR='%s'" % join(expanduser(config.get('DEFAULT', 'local_dir')),'') | |
32 print "PID_DIR='%s'" % join(expanduser(config.get('DEFAULT', 'pid_dir')),'') | |
33 print "LOG_DIR='%s'" % join(expanduser(config.get('DEFAULT', 'pid_dir')),'') | |
34 PYTHONEND | |
35 ` | |
36 PID_FILE="$PID_DIR$NAME.pid" | |
37 LOG_FILE="$LOCAL_DIR$NAME.log" | |
27 DAEMON="n" | 38 DAEMON="n" |
28 MAIN_OPTIONS="-${DAEMON}oy" | 39 MAIN_OPTIONS="-${DAEMON}oy" |
29 TAP_PATH="./" | 40 TAP_PATH="./" |
30 TAP_FILE="$NAME.tac" | 41 TAP_FILE="$NAME.tac" |
31 | 42 |