TIP: Click on subject to list as thread! ANSI
echo: cbm
to: ANDREAS KOHLBACH
from: DROPNINE
date: 2017-06-21 20:06:00
subject: Re: Using tcpser on a Pi

#!/bin/sh

RESULT=`ps -a | sed -n /tcpser/p`

if [ "${RESULT:-null}" = null ]; then
    tcpser 


On Wednesday, June 21, 2017 at 2:40:43 PM UTC-6, Andreas Kohlbach wrote:
> On Tue, 20 Jun 2017 00:45:02 -0700 (PDT), 6502enhanced@gmail.com wrote:
> >
> > Today I had another stop of tcpser. So it ran now for 8 days without
problems.
> >
> > I don't know why it stopped.
> >
> > Has anyone an explanation or a hint what I can do?
> >
> > Here is a pic of the monitor when tcpser stopped:
> >
> > https://s22.postimg.org/ar4ayh2zl/PI_Hayes.jpg
> 
> You might be able to bypass tcpser and most of your setup.
> 
> I just came around info and a video by LGR from YouTube [1] about the
> WIFI232 . Which
> at one end has an RS-232 adapter you plug into any of your old hardware
> (C64, Amiga, Apple ][, Macintosh, RadioShack, Atari, many others from
> back of the day. It claims to be a Hayes compatible modem. Then sets up a
> serial connection and call a terminal program on the computer (I notice
> there is COMMSTAR for many 8bit computers available) and issue AT
> commands. Not only "ATD123456" to dial. Also to connect to your WIFI. I
> think it was something like "ATESSIDmywifi_source". There is a PDF user
> manual in the web some where.
> 
> [1] 
> -- 
> Andreas
> You know you are a redneck if
> you ever lost a loved one to kudzu.

There's a number of those devices and they rock :)  There's a new internal C128
wifi that someone made, too:

https://www.reddit.com/r/c128/comments/6gb28v/internal_swiftlink_compatible_wif
i_modem/

If you still want to get your tcpser working and then auto-restart when it
stops (for whatever reason) just follow these steps (which is explained in my
previous post).

Here's a step-by-step on how to autostart tcpser on the raspberry pi (or any
LINUX):

log into your raspberry pi.

Now, create a file that will be your script. At the bash:
type: cd
type: startSerial

copy and paste the text between the *'s:

************
#!/bin/sh

RESULT=`ps x |grep -v grep |grep -c "tcpser"`

if [ $RESULT = 0 ]; then
    tcpser -s 38400 -d /dev/ttyUSB0 &
************

Change the tcpser parameters to whatever you normally use (minus the debugging
and log parameters).  Make sure you keep the & at the end of the command line.

The variable RESULT stores the number of tcpser commands running.  If it's 0,
then run tcpser command.  If it's not 0 then exit (meaning that tcpser is
already running).

now save and quit the editor by:
Press the  key
type: :wq

you're now at back at the bash.  You need to make the file executable. At the
bash:

type: chmod +x startSerial

and, again, you're at the bash after pressing .

The second part is to make a timer that will run the script every minute.  To
do that, you edit the CRON Table. Again, it's just another text file and it's
just one line.  At the bash:

type: crontab -e

if it asks you what editor you want, select 2) nano.

now use the cursor key to scroll all the way down to the last line and enter
(or copy/paste the line below):

*/1 * * * * /home/pi/startSerial

The menu at the bottom your display shows you how to exit the editor. Press
, then Y and finally your  key to save the text.  The above line
tells the your pi to run the startSerial script you just wrote every minute. 
If you want to 
change it to a slower interval, change the 1 to a 5 for a 5 minute interval, 10
for a 10 minute interval, etc.

To test it, wait a minute and at the bash:

type: ps x |grep -v grep |grep -c "tcpser"

There should be a 1.  If it reports a 0, then you need check your typing and
make sure you set the startSerial file to execute with chmod +x.
 
-----
There are many ways to get the job done.  The @reboot command also has its
merits in starting a file at boot.

works for me :)

Cheers,
Carl

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.