hamlib: Stopping/starting rigctld and rotctld via Bash script

Stopping rigctld and rotctld:


#!/bin/bash

# finds rigctl and rotctl PIDs and SIGTERMs them
# Michael Hirsch

RigPID=$(pgrep rigctld)
RotPID=$(pgrep rotctld)

if [[ -n $RigPID ]]; then
echo "Stopping rigctld PID $RigPID"
kill $RigPID
fi

if [[ -n $RotPID ]]; then
echo "Stopping rotctld PID $RotPID"
kill $RotPID
fi

Starting rigctld and rotctld: for Kenwood TS-2000 on /dev/ttyS0 and Yaesu GS-232B rotor controller on /dev/ttyS1


RigPID=$(pgrep rigctld)
RotPID=$(pgrep rotctld)

if [[ -z $RigPID ]]; then
echo "Started rigctld"
rigctld --model=214 --rig-file=/dev/ttyS0 --serial-speed=57600 -C serial_handshake=Hardware,post_write_delay=10 &
fi

if [[ -z $RotPID ]]; then
echo "Starting rotctld"
rotctld --model=603 --rot-file=/dev/ttyS1 --serial-speed=9600 -C serial_handshake=Hardware,post_write_delay=10 &
fi

Remember: if using GPredict with Hamlib, do not use -v verbose options, since the extra text output will confuse Gpredict.

rigctl / hamlib with Kenwood TS-2000

On a modern PC, you may notice intermittent errors with the Kenwood TS-2000 , something like:
read_string(): Timed out 0.2 seconds without reading a character.

The solution seems to be making rigctl wait for the TS-2000 to catchup by using the hardware handshake–you need a “real” RS232 cable for this to work, with the correct DSR/RTS pins included and connected.

try the command:
rigctl -m 214 -s 57600 -r COM1 -C serial_handshake=Hardware