aboutsummaryrefslogtreecommitdiff
path: root/network/users-agent/rc.users-agent
blob: 304eca03dcc79c5e21d38d6c836f20b9f2b5971f (plain)
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
#!/bin/sh

users_agent_start() {
  if [ ! -e /var/run/users-agent/jud.pid ]; then
    su - %JUDUSR% -c "/usr/bin/users-agent -c /etc/users-agent/config.xml &"
    su - %JUDUSR% -c "ps ux" | awk '/users-agent/ && !/awk/ {print $2}' > /var/run/users-agent/jud.pid
  fi
}

users_agent_stop() {
  kill  `cat /var/run/users-agent/jud.pid 2> /dev/null` 2> /dev/null
  rm -rf /var/run/users-agent/jud.pid 2> /dev/null
}

case $1 in
'start')
  users_agent_start
  ;;
'stop')
  users_agent_stop
  ;;
'restart')
  users_agent_stop
  sleep 2
  users_agent_start
  ;;
*)
  echo "usage: `basename $0` {start|stop|restart}"
esac