command line link/unlink

Help with D-Star related issues
Post Reply
w7efs
Posts: 94
Joined: Sun Apr 22, 2018 4:26 pm

command line link/unlink

Post by w7efs » Sat May 19, 2018 5:58 pm

How does one link/unlink to a given reflector from the command line, please.

We have a need to cron this activity so that various regular nets can be heard.

Thank you.

MW0MWZ
Site Admin
Posts: 362
Joined: Wed Apr 04, 2018 9:15 pm
Location: Wales, UK
Contact:

Re: command line link/unlink

Post by MW0MWZ » Sat May 19, 2018 7:01 pm

Link to REF001 C

Code: Select all

sudo pistar-link ref001_c
Unlink

Code: Select all

sudo pistar-link unlink
Here is the full output from the command:

Code: Select all

[email protected](ro):~$ sudo pistar-link
To unlink from any connected reflector, use: pistar-link unlink
To link to REF000 A for example, use: pistar-link ref000_a

If you need to make a reflector FIXED so that users cannot unlink,
for schedulling connections via CRON for example you can use the
the following: pistar-link ref000_a fixed
Should you wish to Un-Fix a reflector, relink to the same reflector
without the fixed flag, such as: pistar-link ref000_a
Hope that helps!
Andy

73 de MW0MWZ
http://pistar.uk

w7efs
Posts: 94
Joined: Sun Apr 22, 2018 4:26 pm

Re: command line link/unlink

Post by w7efs » Mon May 21, 2018 2:56 am

Perfect, Andy, thank you.

n5amd
Posts: 27
Joined: Wed Apr 11, 2018 9:05 pm
Location: San Antonio Texas
Contact:

Re: command line link/unlink

Post by n5amd » Wed Jun 13, 2018 5:33 am

This is awesome! I had no idea. Thank you.

w7efs
Posts: 94
Joined: Sun Apr 22, 2018 4:26 pm

Re: command line link/unlink

Post by w7efs » Wed Oct 10, 2018 8:20 pm

Somehow the command seems to have gotten broken. While linked to a reflector:

# pistar-link unlink
remotecontrold: no address, port, or password is set

In /etc/ircddbgateway, remoteEnabled=1 with an assigned port and password. Permissions on the files look correct:

# ls -l $(which pistar-link remotecontrold)
-r-xr-xr-x 1 root bin 869036 Aug 2 2016 /usr/local/bin/remotecontrold
-rwxr-xr-x 1 root staff 1823 Mar 7 2018 /usr/local/sbin/pistar-link

... yet we're unable to unlink from the startup reflector or link to any other, using either the command line or the Admin web page. Any suggestions, please?

AF6VN
Posts: 74
Joined: Fri Jul 20, 2018 1:15 am

Re: command line link/unlink

Post by AF6VN » Thu Oct 11, 2018 1:01 am

That date stamp for pistar-link may be of concern...

Code: Select all

[email protected](ro):~$ ls -l $(which pistar-link remotecontrol remotecontrold)
-r-xr-xr-x 1 root bin   2354276 Aug  2  2016 /usr/local/bin/remotecontrol
-r-xr-xr-x 1 root bin    869036 Aug  2  2016 /usr/local/bin/remotecontrold
-rwxr-xr-x 1 root staff    1823 Jul 13 13:59 /usr/local/sbin/pistar-link
[email protected](ro):~$
... though the size looks the same...

--
AF6VN
Dennis L Bieber

w7efs
Posts: 94
Joined: Sun Apr 22, 2018 4:26 pm

Re: command line link/unlink

Post by w7efs » Thu Oct 11, 2018 1:47 am

AF6VN thank you much, yes, ours is outdated relative to yours, despite the daily cron update and a manual pistar-{update,upgrade} since your reply. Here's the text of our pistar-link, and does that agree with yours, please:

# #
# Make it simple to link reflectors from the CLI on Pi-Star. #
# Origional suggestion by Adrian (VK4TUX) #
# #
##############################################################################
#
if [ "$(id -u)" != "0" ]; then
echo -e "You need to be root to run this command...\n"
exit 1
fi

# Setup some variables
cmd=/usr/local/bin/remotecontrold
module=$(grep -m 1 'callsign=' /etc/dstarrepeater | awk -F "=" '/callsign/ {print $2}')

if [ -z "$1" ]
then
echo "To unlink from any connected reflector, use: pistar-link unlink"
echo "To link to REF000 A for example, use: pistar-link ref000_a"
echo ""
echo "If you need to make a reflector FIXED so that users cannot unlink,"
echo "for schedulling connections via CRON for example you can use the"
echo "the following: pistar-link ref000_a fixed"
echo "Should you wish to Un-Fix a reflector, relink to the same reflector"
echo "without the fixed flag, such as: pistar-link ref000_a"
echo ""
exit 0
fi

if [ -z "$2" ]
then
relink=never
else
relink=${2}
fi

case ${1} in
*unlink)
${cmd} "${module}" unlink
exit 0
;;
*)
${cmd} "${module}" link ${relink} $1
exit 0
;;
esac

exit 0

AF6VN
Posts: 74
Joined: Fri Jul 20, 2018 1:15 am

Re: command line link/unlink

Post by AF6VN » Thu Oct 11, 2018 2:52 am

Well, the actual shell script looks similar, but the opening comments are different... Or you failed to copy the entire script.

Code: Select all

cat /usr/local/sbin/pistar-link
#!/bin/bash
#
##############################################################################
#                                                                            #
#                     Pi-Star ircDDBGateway link Tool                        #
#                                                                            #
#     Version 1.0, Code, Design and Development by Andy Taylor (MW0MWZ).     #
#                                                                            #
#         Make it simple to link reflectors from the CLI on Pi-Star.         #
#                  Origional suggestion by Adrian (VK4TUX)                   #
#                                                                            #
##############################################################################
#
if [ "$(id -u)" != "0" ]; then
  echo -e "You need to be root to run this command...\n"
  exit 1
fi

# Setup some variables
cmd=/usr/local/bin/remotecontrold
module=$(grep -m 1 'callsign=' /etc/dstarrepeater | awk -F "=" '/callsign/ {print $2}')

if [ -z "$1" ]
then
      echo "To unlink from any connected reflector, use: pistar-link unlink"
      echo "To link to REF000 A for example, use: pistar-link ref000_a"
      echo ""
      echo "If you need to make a reflector FIXED so that users cannot unlink,"
      echo "for schedulling connections via CRON for example you can use the"
      echo "the following: pistar-link ref000_a fixed"
      echo "Should you wish to Un-Fix a reflector, relink to the same reflector"
      echo "without the fixed flag, such as: pistar-link ref000_a"
      echo ""
      exit 0
fi

if [ -z "$2" ]
then
      relink=never
else
      relink=${2}
fi

case ${1} in
*unlink)
  ${cmd} "${module}" unlink
  exit 0
;;
*)
  ${cmd} "${module}" link ${relink} $1
  exit 0
;;
esac

exit 0
[email protected](ro):~$

--
AF6VN
Dennis L Bieber

ct1dvm
Posts: 125
Joined: Thu Apr 19, 2018 6:34 am

Re: command line link/unlink

Post by ct1dvm » Thu Oct 11, 2018 8:59 am

..
Last edited by ct1dvm on Fri Oct 12, 2018 12:20 pm, edited 1 time in total.

w7efs
Posts: 94
Joined: Sun Apr 22, 2018 4:26 pm

Re: command line link/unlink

Post by w7efs » Thu Oct 11, 2018 5:10 pm

AF6VN wrote:
Thu Oct 11, 2018 2:52 am
Well, the actual shell script looks similar, but the opening comments are different... Or you failed to copy the entire script.
Thanks for your assistance. I restored from a backup and all is well again.

Post Reply