Repository navigation
Expand file tree
/
Copy pathnp.sh
More file actions
96 lines (80 loc) · 2.17 KB
/
Copy pathnp.sh
File metadata and controls
96 lines (80 loc) · 2.17 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
npu
asadmin@c634yuvnhpg01:/appserver/np/npu/scripts> more npu
#!/bin/bash
#
# newsplusupdater Newsplus updater ingests JMS feed from Swift News updater and generates metadata,
#
# chkconfig: 2345 15 85
# description: Newsplus updater
#
# Copyright Thomson Reuters
#
### BEGIN INIT INFO
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Newsplus updater
# Description: Newsplus updater ingests JMS feed from Swift News updater and generates metadata, indexes and persists feed.
### END INIT INFO
PIDFILE=/appserver/np/npu/scripts/npu.pid
PATH=$PATH:/appserver/np/npu
prog="NewsplusUpdater"
NEWSPLUS_USER=asadmin
RETVAL=0
# Source function library.
#. /etc/rc.d/init.d/functions
usage ()
{
echo "Usage: service $prog {start|stop|status|restart}"
RETVAL=1
}
start()
{
#check if process is running
if [ -f $PIDFILE ]; then
echo $"$prog is already running...stopping process"
stop
fi
echo -n $"Starting $prog: "
su - $NEWSPLUS_USER /appserver/np/npu/scripts/start-npu.sh realtime realtime 3002
}
stop()
{
echo -n $"Stopping $prog: "
processPid=$(<"$PIDFILE")
kill -1 $processPid
echo -n $"Pipeline shutdown initiated "
rm -rf $PIDFILE
}
restart()
{
stop
start
}
status()
{
if [ -f $PIDFILE ]; then
processPid=$(<"$PIDFILE")
if ps aux | grep "$processPid" | grep -v "grep"
then
echo -n $"$prog running, pid=$processPid"
else
echo -n $"$prog not running"
fi
else
echo -n $"$prog not running"
fi
}
case "$1" in
start|stop|restart|condrestart|try-restart|force-reload)
# [ `id -u` != "0" ] && exit 4 ;;
esac
case "$1" in
start) start; RETVAL=$? ;;
stop) stop; RETVAL=$? ;;
status) status -p $PIDFILE $prog ; RETVAL=$? ;;
restart) restart; RETVAL=$? ;;
reload) RETVAL=3 ;;
*) usage ; RETVAL=2 ;;
esac
exit $RETVAL
asadmin@c634yuvnhpg01:/appserver/np/npu/scripts>