blob: 61f72afcf03957da601f006811917368f969c0b9 (
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
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
|
#!/bin/bash
#
# By Steven King 11/3/2010
# kingrst@gmail.com
#
# Modified by Pierre Cazenave 3rd November 2010
# pwcazenave <at> gmail {dot} com
#
# Starts the Synergy-Plus Server
#
synergy_start() {
if [ -f /var/run/synergys.pid ]; then
echo "Synergy Server is already running"
exit 1
elif [ -x /usr/bin/synergys ]; then
/usr/bin/synergys || exit $?
pidof synergys > /var/run/synergys.pid
echo "Synergy Server Started"
fi
}
synergy_stop() {
if [ -f /var/run/synergys.pid ]; then
kill $(cat /var/run/synergys.pid) || echo "Unable to stop Synergy Server"
rm -f /var/run/synergys.pid
echo "Synergy Server Stopped"
else
echo "Synergy Server is not started"
fi
}
synergy_status() {
if [ -f /var/run/synergys.pid ]; then
echo "Synergy Server Running"
echo "PID: $(cat /var/run/synergys.pid)"
else
echo "Synergy Server is not started"
fi
}
case "$1" in
"start")
synergy_start
;;
"stop")
synergy_stop
;;
"status")
synergy_status
;;
"restart")
synergy_stop
sleep 1
synergy_start
;;
*)
echo "$0 Usage: [start|stop|restart|status]"
;;
esac
|