parent
d5fc04485b
commit
ef9040c46d
6 changed files with 721 additions and 2 deletions
42
scripts/zoteroconf.sh
Executable file
42
scripts/zoteroconf.sh
Executable file
|
@ -0,0 +1,42 @@
|
|||
#!/bin/sh
|
||||
if [ ! "$1" ]; then
|
||||
echo "Action not specified"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $1 = "find_instances" ]; then
|
||||
dns-sd -B _zotero._tcp local. > /tmp/zoteroconf_instances &
|
||||
|
||||
elif [ $1 = "kill_find_instances" ]; then
|
||||
PIDs=`ps x | grep "dns-sd -B" | grep _zotero._tcp | sed -E 's/ *([0-9]+).*/\1/' | xargs`
|
||||
if [ "$PIDs" ]; then
|
||||
kill $PIDs
|
||||
fi
|
||||
|
||||
elif [ $1 = "get_info" ]; then
|
||||
if [ ! "$2" ]; then
|
||||
echo "Service name not specified"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! "$3" ]; then
|
||||
echo "Temp file path not specified"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#dns-sd -L "$2" _zotero._tcp local. > $3 &
|
||||
mDNS -L "$2" _zotero._tcp local. > $3 &
|
||||
|
||||
elif [ $1 = "kill_get_info" ]; then
|
||||
#PIDs=`ps x | grep "dns-sd -L" | grep _zotero._tcp | sed -E 's/ *([0-9]+).*/\1/' | xargs`
|
||||
PIDs=`ps x | grep "mDNS -L" | grep _zotero._tcp | sed -E 's/ *([0-9]+).*/\1/' | xargs`
|
||||
if [ "$PIDs" ]; then
|
||||
kill $PIDs
|
||||
fi
|
||||
|
||||
elif [ $1 = "kill_service" ]; then
|
||||
PIDs=`ps x | grep dns-sd | grep '_zotero._tcp' | sed -E 's/ *([0-9]+).*/\1/' | xargs`
|
||||
if [ "$PIDs" ]; then
|
||||
kill $PIDs
|
||||
fi
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue