Skip to content

Commit f0d791d

Browse files
committed
Add initial Synergy server wrapper script
Add initial version of a wrapper script for the Synergy server; needs testing on macOS Signed-off-by: Scott Lowe <[email protected]>
1 parent 6ed84eb commit f0d791d

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Diff for: synserver

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
3+
# Check for correct parameters (exactly one sub-command expected)
4+
if [ "$#" -ne 1 ]; then
5+
echo "Incorrect number of parameters; please specify 'start' or 'stop'"
6+
exit 1
7+
fi
8+
9+
# Set the name of the sub-command
10+
CMD=$1
11+
12+
# Get the path of the synergys binary
13+
SYNCMD=$(command -v synergys)
14+
15+
if [[ $CMD == "start" ]]; then
16+
if pgrep -x "synergys" > /dev/null 2>&1; then
17+
echo "Synergy server already running"
18+
exit 1
19+
else
20+
echo "Starting Synergy server"
21+
$SYNCMD
22+
fi
23+
elif [[ $CMD == "stop" ]]; then
24+
pkill -x "synergys"
25+
else
26+
echo "Unrecognized command given"
27+
fi

0 commit comments

Comments
 (0)