File: interdaemon2.ini

package info (click to toggle)
postman 2.1-6
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 8,248 kB
  • ctags: 3,249
  • sloc: cpp: 33,376; ansic: 2,014; sh: 768; makefile: 300
file content (50 lines) | stat: -rwxr-xr-x 1,143 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh
#

PATH=/sbin:/usr/sbin:/usr/bin:/bin
export PATH

rval=0
set_return() {
        x=$?
        if [ $x -ne 0 ]; then
                echo "EXIT CODE: $x"
                rval=1  # always 1 so that 2 can be used for other reasons
        fi
}


case $1 in
start_msg)
        echo "Start daemon"
        ;;

stop_msg)
        echo "Stopping daemon"
        ;;
'start')
        find /var/postman2/locks/ -type f -exec rm {} \;
        find /var/postman2/sessions/ -type s -exec rm {} \;
        find /var/postman2/tmp/ -type f -exec rm {} \;
        if [ -x /usr/local/sbin/interdaemon2  ]; then
           ( su - postman -c "cd /usr/local/sbin; PATH=$PATH:. HOME=/var/postman2 /usr/bin/nohup interdaemon2 /usr/local/etc/interdaemon2.cfg >/tmp/interdaemon2.out 2>&1 &" ) && echo "daemon"
           set_return
        else
           rval=2
        fi
        ;;

'stop')
        export UNIX95=XPG4  
        PIDS=`ps -ae -opid,args | egrep "^[0-9 ]+ interdaemon2 " | cut -c1-5`
        echo $PIDS | xargs kill
        echo "daemon stopped"
        ;;

*)
        echo "usage: $0 {start|stop}"
        rval=1
        ;;
esac

exit $rval