annotate src/sat.sh @ 388:a617af506154

core: progress callback now use id as first parameter
author Goffi <goffi@goffi.org>
date Thu, 29 Sep 2011 12:14:19 +0200
parents e83d0c21d64d
children ac568832a71a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
3c1cefd41186 added sat executable
Goffi <goffi@goffi.org>
parents:
diff changeset
1 #!/bin/sh
225
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents: 223
diff changeset
2
234
a7079e835432 added stop command in sat.sh launching script
Goffi <goffi@goffi.org>
parents: 226
diff changeset
3 #if there is one argument which is "stop", then we kill SàT
249
0ed5553b5313 added "debug" command to sat launcher script
Goffi <goffi@goffi.org>
parents: 234
diff changeset
4 DEBUG=""
234
a7079e835432 added stop command in sat.sh launching script
Goffi <goffi@goffi.org>
parents: 226
diff changeset
5 if [ $# -eq 1 ];then
a7079e835432 added stop command in sat.sh launching script
Goffi <goffi@goffi.org>
parents: 226
diff changeset
6 if [ $1 = "stop" ];then
a7079e835432 added stop command in sat.sh launching script
Goffi <goffi@goffi.org>
parents: 226
diff changeset
7 echo "Terminating Salut à Toi"
315
31804aa9d3da core: fixed stop script
Goffi <goffi@goffi.org>
parents: 249
diff changeset
8 pkill -f "twistd.*/sat.tac"
234
a7079e835432 added stop command in sat.sh launching script
Goffi <goffi@goffi.org>
parents: 226
diff changeset
9 exit 0
a7079e835432 added stop command in sat.sh launching script
Goffi <goffi@goffi.org>
parents: 226
diff changeset
10 fi
249
0ed5553b5313 added "debug" command to sat launcher script
Goffi <goffi@goffi.org>
parents: 234
diff changeset
11 if [ $1 = "debug" ];then
0ed5553b5313 added "debug" command to sat launcher script
Goffi <goffi@goffi.org>
parents: 234
diff changeset
12 echo "Launching SàT in debug mode"
0ed5553b5313 added "debug" command to sat launcher script
Goffi <goffi@goffi.org>
parents: 234
diff changeset
13 DEBUG="--debug"
0ed5553b5313 added "debug" command to sat launcher script
Goffi <goffi@goffi.org>
parents: 234
diff changeset
14 fi
234
a7079e835432 added stop command in sat.sh launching script
Goffi <goffi@goffi.org>
parents: 226
diff changeset
15 fi
a7079e835432 added stop command in sat.sh launching script
Goffi <goffi@goffi.org>
parents: 226
diff changeset
16
225
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents: 223
diff changeset
17 NAME='sat'
4
3c1cefd41186 added sat executable
Goffi <goffi@goffi.org>
parents:
diff changeset
18
369
e83d0c21d64d launching script now read config files
Goffi <goffi@goffi.org>
parents: 358
diff changeset
19 #We use python to parse config files
e83d0c21d64d launching script now read config files
Goffi <goffi@goffi.org>
parents: 358
diff changeset
20 eval `python<<PYTHONEND
e83d0c21d64d launching script now read config files
Goffi <goffi@goffi.org>
parents: 358
diff changeset
21 from ConfigParser import SafeConfigParser
e83d0c21d64d launching script now read config files
Goffi <goffi@goffi.org>
parents: 358
diff changeset
22 from os.path import expanduser, join
e83d0c21d64d launching script now read config files
Goffi <goffi@goffi.org>
parents: 358
diff changeset
23
e83d0c21d64d launching script now read config files
Goffi <goffi@goffi.org>
parents: 358
diff changeset
24 config = SafeConfigParser(defaults={'local_dir':'~/.sat',
e83d0c21d64d launching script now read config files
Goffi <goffi@goffi.org>
parents: 358
diff changeset
25 'pid_dir':'/tmp',
e83d0c21d64d launching script now read config files
Goffi <goffi@goffi.org>
parents: 358
diff changeset
26 'log_dir':'%(local_dir)s'})
e83d0c21d64d launching script now read config files
Goffi <goffi@goffi.org>
parents: 358
diff changeset
27 try:
e83d0c21d64d launching script now read config files
Goffi <goffi@goffi.org>
parents: 358
diff changeset
28 config.read(map(expanduser, ['/etc/sat.conf', '~/sat.conf', '~/.sat.conf', 'sat.conf', '.sat.conf']))
e83d0c21d64d launching script now read config files
Goffi <goffi@goffi.org>
parents: 358
diff changeset
29 except:
e83d0c21d64d launching script now read config files
Goffi <goffi@goffi.org>
parents: 358
diff changeset
30 print ("Can't read main config !")
e83d0c21d64d launching script now read config files
Goffi <goffi@goffi.org>
parents: 358
diff changeset
31 print "LOCAL_DIR='%s'" % join(expanduser(config.get('DEFAULT', 'local_dir')),'')
e83d0c21d64d launching script now read config files
Goffi <goffi@goffi.org>
parents: 358
diff changeset
32 print "PID_DIR='%s'" % join(expanduser(config.get('DEFAULT', 'pid_dir')),'')
e83d0c21d64d launching script now read config files
Goffi <goffi@goffi.org>
parents: 358
diff changeset
33 print "LOG_DIR='%s'" % join(expanduser(config.get('DEFAULT', 'pid_dir')),'')
e83d0c21d64d launching script now read config files
Goffi <goffi@goffi.org>
parents: 358
diff changeset
34 PYTHONEND
e83d0c21d64d launching script now read config files
Goffi <goffi@goffi.org>
parents: 358
diff changeset
35 `
e83d0c21d64d launching script now read config files
Goffi <goffi@goffi.org>
parents: 358
diff changeset
36 PID_FILE="$PID_DIR$NAME.pid"
e83d0c21d64d launching script now read config files
Goffi <goffi@goffi.org>
parents: 358
diff changeset
37 LOG_FILE="$LOCAL_DIR$NAME.log"
225
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents: 223
diff changeset
38 DAEMON="n"
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents: 223
diff changeset
39 MAIN_OPTIONS="-${DAEMON}oy"
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents: 223
diff changeset
40 TAP_PATH="./"
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents: 223
diff changeset
41 TAP_FILE="$NAME.tac"
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents: 223
diff changeset
42
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents: 223
diff changeset
43 #Don't change the next line
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents: 223
diff changeset
44 AUTO_OPTIONS=""
249
0ed5553b5313 added "debug" command to sat launcher script
Goffi <goffi@goffi.org>
parents: 234
diff changeset
45 ADDITIONAL_OPTIONS="--pidfile $PID_FILE --logfile $LOG_FILE $AUTO_OPTIONS $DEBUG"
225
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents: 223
diff changeset
46
226
d8bb72f00eec distutils install: fixed plugin import and log file path
Goffi <goffi@goffi.org>
parents: 225
diff changeset
47 log_dir=`dirname "$LOG_FILE"`
d8bb72f00eec distutils install: fixed plugin import and log file path
Goffi <goffi@goffi.org>
parents: 225
diff changeset
48 if [ ! -d $log_dir ] ; then
d8bb72f00eec distutils install: fixed plugin import and log file path
Goffi <goffi@goffi.org>
parents: 225
diff changeset
49 mkdir $log_dir
d8bb72f00eec distutils install: fixed plugin import and log file path
Goffi <goffi@goffi.org>
parents: 225
diff changeset
50 fi
d8bb72f00eec distutils install: fixed plugin import and log file path
Goffi <goffi@goffi.org>
parents: 225
diff changeset
51
225
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents: 223
diff changeset
52 twistd $MAIN_OPTIONS $TAP_PATH$TAP_FILE $ADDITIONAL_OPTIONS