Please be aware that this is an old version which is no longer supported!
You may find a daemon version of this script which offers a lot more features here:
http://download.prgm.org/dl5di-soft/dstar-tools/dstar-unlinkd
Please switch the language of that page to your needs.


ds-unlink

This perl-script unlinks a connection from the DStar-gateway to another gateway or a reflector after a specified timeout.
It can also set up a specified default link after the timeout.

The script reads the status-file created by dplus.
Currently it expects the format of dplus version 2.2c.

The script controles 1 repeater module.
If you want to control several modules please make as much copies as you need, call it like "ds-unlink-A", "ds-unlink-B" and "ds-unlink-C", configure it for each modul individually and start it separate from cron as often as you like.

In the head of the script you need to configure a few parameters:


Here a sample:


#-----------------------------------------------------------------------------
# Configuration Part:
#-----------------------------------------------------------------------------
#
# the BASE-Callsign of the repeater (in upper case):
$RptrCall = "DB0MYK";

# the ID of the modul that you want to unlink (in upper case):
$Modul = "B";
#
# minimum idle timeout for local traffic (in seconds)
# the maximum value is given by this value plus the time between startups by cron
$LocalTimeout = 720;
# Waittime after local traffic until the defaultlink will be set up again
$SetupWaittime = 1800;
# # path and name of the logfile (switch off logging by using /dev/null)
$logfile = "/var/log/ds-unlink-$Module.log";
#
# location of the dplus-statusfile
#$statusfile = "/dstar/tmp/status";
#


A default-link can be defined in the file

    /dstar/tmp/defaultlink-?

where the "?" is the letter for the module on which it should be established.

The content of this file must be the callsign or reflectorname filled up with spaces to 7 chars, followed by the module ID at the 8th position and a final linefeed.

Example:

In my case I have a file /dstar/tmp/defaultlink-b and it's content is "REF006 D"

This connects my module B to REF006 Module D.
 

Another control file is

    /dstar/tmp/ds-unlink-?-off

example:

    /dstar/tmp/ds-unlink-b-off

If this file exists the script controlling module "B" will be switched off.


How it works:


Defaultlinks can easily be set und unset by cron:


That should be all!

It may be necessary to modify other settings if the dplus-installation is not default.

The logfiles will get different names for each module automatically, the modulname is always appended to the basename of the logfile.
Better do not change anything on that unless you know what you are doing.
Do not use the same logfile for different modules / instances of this tool, it will mess up the log or create errors!
If you have only limited diskspace you may switch logging off by setting $logfile="/dev/null";

You need to start the scripts regular from cron.
I have only 1 repeater modul in use and run 1 copy every 3 minutes.
This time gives the precision of the timeout.
Just an extreme sample: it makes no sense to set a timeout of 2 minutes, but start the script only once per hour.

Here my crontab entry:

1-59/3 * * * * /dstar/scripts/ds-unlink-B

(I normally save minute "0" of each hour because at that time my time-beacon is sent out which should not be disturbed by an unlink message of this tool).


After an update of dplus the format of it's status-file needs to be checked and possibly be updated.
dplus version 2.2a will not work, the statusfile does not supply the necessary last-heard information.


My first intention was to also check the remote activity of a link and have a separate timeout value for that.
With this timeout a link could be disconnected in case of long lasting local QSOs without any active user on the remote site. Some local users often do not know that they are talking through a reflector to the whole world and how to unlink.
(The whole linking and unlinking is surely not very comfortable for mobile stations anyway).

Unfortunately the current dplus version and also the standard Postgres database on the gateway do not supply information about remote activity.
DStarMon - which is also working on the gateway - can provide that information in the Last-Xmt-table to any Postgres- or mySQL-database. In that case this needs to be configured and some additional perl-modules (DBI/DBD/mysql/pgqsl) would need to be installed.
I wounder if that effort really makes sense for such a simple tool.

Another issue are frequently beacons to reflectors from some repeaters that would trigger this timeout. I found that spammers on reflectors sending out beacons every 60 seconds and I did not find any filter criterias to get rid of that nonsense.

If you have any questions or remarks please let me know.

Thanks to Richard, VK3JFK, who brought in some good ideas!
 

Finally the Download-Link:

    http://download.prgm.org/dl5di-soft/dstar-tools/dstar-unlink/ds-unlink-latest.tgz

may 10th 2009

73 de Hans, DL5DI
 

Email: dl5di - at - prgm.org
Web:   http://dl5di.prgm.org