Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using tcpser on a Pi for telnet gateway to C64?

642 views
Skip to first unread message

Jimmy Mac

unread,
Mar 23, 2017, 9:00:43 PM3/23/17
to

Hi all,

I've struggled to find much in the way of solid documentation on how to get tcpser to autostart on the Raspberry Pi. Anyone have a quick easy solution?
I blame my 30 years of Microsoft on my Linux ignorance but I'm evolving :-)

Trying to resurrect (rebuild) a C46 BBS. No problems getting tcpser to work from ssh or local terminal, just can't get any of the examples I've read about to work on the Pi.

TIA!

Jim..

Andreas Kohlbach

unread,
Mar 24, 2017, 2:48:33 PM3/24/17
to
On Thu, 23 Mar 2017 18:00:42 -0700 (PDT), Jimmy Mac wrote:
>
> I've struggled to find much in the way of solid documentation on how
> to get tcpser to autostart on the Raspberry Pi.

Why? Does your BBS need this?

> Anyone have a quick easy solution? I blame my 30 years of Microsoft on
> my Linux ignorance but I'm evolving :-)

I never had any Raspberrys Linuxes but most Linux distributions know
"service", or when they have systemd also "systemctrl".

Try something like

service tcpser enable

as root. That might take care of having it started on each boot from then
on.

The name might be different to tcpser thought. Have a look into
/etc/init.d/ for possible candidates.

ls /etc/init.d/
--
Andreas
You know you are a redneck if
you had to remove a toothpick for wedding pictures.

Drew Klenotic

unread,
Mar 25, 2017, 5:23:05 AM3/25/17
to
On 23 Mar 17 18:00:42 Jimmy Mac wrote...

JM> Hi all,
JM>
JM> I've struggled to find much in the way of solid documentation on how
JM> to get tcpser to autostart on the Raspberry Pi. Anyone have a quick
JM> easy solution? I blame my 30 years of Microsoft on my Linux ignorance
JM> but I'm evolving :-)
JM>
JM> Trying to resurrect (rebuild) a C46 BBS. No problems getting tcpser
JM> to work from ssh or local terminal, just can't get any of the
JM> examples I've read about to work on the Pi.
JM>
JM> TIA!
JM>
JM> Jim..
JM>
JM> --- SoupGate-Win32 v1.05 * Origin: Agency HUB, Dunedin - New Zealand
JM> | Fido<>Usenet Gateway (3:770/3)

To which Drew Klenotic replies...

Why re-invent the wheel? http://www.particles.org/particlesbbs/ is a
C128 BBS on "the net". This guy is probably one of the best examples of
a great old school retro BBS. He literally has more activity in a day
than I have in weeks. He's the guy we're all wishing we were.

Check in with him. I'm sure he'd be happy to help. If not, I'd be happy
to help (I'm an Atari guy, but the basic principles are the same).

Also on Facebook. https://www.facebook.com/particlesbbs/

CBMGuy

unread,
Mar 30, 2017, 11:33:46 AM3/30/17
to
On Thursday, March 23, 2017 at 7:00:43 PM UTC-6, Jimmy Mac wrote:
> Hi all,
>
> I've struggled to find much in the way of solid documentation on how to get tcpser to autostart on the Raspberry Pi. Anyone have a quick easy solution?


Hey there. I just did this for an old Atari STe I fixed and wanted to BBS. I have an old Raspberry Pi Model B and a MAX232 serial 9pin for the PI (it's about $1.50 for the MAX232 from ebay--I have a number of these already which is why I used them for the project). I hooked the Pi up to the Pi's GPIO port. The only issue with this setup is that the Pi monitors that port for remote logins and yo need to disable that function. You can use raspi-config to change those settings. If you are using a USB to serial adaptor, you can skip this and hop down to the automated service in LINUX section below.

To turn the GPIO header for serial:

Type at the bash: sudo raspi-config

Selected option 5 from the menu, then selected Serial from that menu. Choose No to the login shell over serial. Then yes to enabling the serial port hardware. exit out of the tool and back to the bash.

Physical connections from the Max232 to the PI GPIO:

MAX232 Pi GPOI
Vcc 3.3V pin 2
GND GND pin 6
Tx Rx pin 10
Rx Tx pin 8

Setting up to automate tcpser on boot:

Create a text file (I just put it in the home directory) and make it executable. At the bash:

type: cd <Enter>
type: vi serialBridge <Enter>
type: i
type: #!/bin/sh <Enter>
type: tcpser -s 19200 -d /dev/ttyAMA0 &
type <Esc>:wq <Enter>

you're now out of the editor and back at the bash.

type: chmod +x serialBridge

that will make the file executable (like a batch file in DOS). Change the 19200 baud rate to whatever you need it to be.

You need to create another text file that instructs LINUX a service is available. To do that, we create another text file in a very specific spot and then issue some commands to tell LINUX to use it when it's booting. to do that:

type: vi /lib/systemd/system/serialBridge.service <Enter>
type: i

copy and paste everything between the # marks into the editor:

####################
[Unit]
Description=Serial to TCP-IP Bridge
After=Multi-User.target

[Install]
WantedBy=Multi-user.target

[Service]
ExecStart=/home/pi/serialBridge
type=forked
#####################

You're still in the editor:
type: <Esc>:wq <Enter>

You will now be out of the editor and at the bash prompt.

type: sudo systemctl enable serialBridge.service
type: sudo systemctl start serialBridge.service
type: sudo systemctl status serialBridge.service

The first command will instruct LINUX the service should be enabled at boot (level 3). The second command will tell LINUX to start the service right now. The third command will just display the status of the service we just started with the previous command.

Run a terminal, turn flow control off, set the baud rate proper and "ATDT dnsName:port" in the term and you're good to go. Enjoy :)

*If you have any problems, please let me know and I'll be glad to help. I have the pictures and such on my facebook page blogging the project I just did.

One thing I'd like to note is that I thought tcpser, by default, used RTS/CTS flow control. I had to disable the flow control on the Atari before any data came through... I'm not sure if this is due to the buggy serial port or just something I have overlooked.... Just a head's up in case you do not see anything going through.

Cheers,
Carl

CBMGuy

unread,
Mar 30, 2017, 11:36:11 AM3/30/17
to
I forgot to mention that if you are using an USB to Serial adaptor, Everything is the same in the LINUX setup except the tcpser device would be ttyUSB0. not ttyAMA0. Sorry for missing that info.

Cheers,
Carl

CBMGuy

unread,
Mar 30, 2017, 12:50:49 PM3/30/17
to
On Thursday, March 30, 2017 at 9:33:46 AM UTC-6, CBMGuy wrote:
SOB. I missed one thing that will bugger you up creating the .service file. you need to be root and I forgot the sudo prefix in the step... Enter sudo vi /lib/systemd/system/serialBridge.service <Enter>

sorry for the snafu... I'm really buggering this up. My memory seems to be pretty buggy lately. If it means anything, I've taken my break at work to create a proper text file and also included a wireless WIFI setup to make it free of the extra cabling. Let me know if you would like that doc.

Cheers,
carl

Jimmy Mac

unread,
Mar 30, 2017, 2:17:40 PM3/30/17
to
Carl! You ROCK! I hadn't even considered the MAX232 method. I've been using a serial to USB cable and a Commodore 1011 RS-232 cart. No worries on root. I would have done that anyway. Many thanks!

I may just have to break down and try this with the Max232 with a new Pi Zero W. Nice small package.

J..

Jimmy Mac

unread,
Mar 30, 2017, 2:19:42 PM3/30/17
to
On Friday, March 24, 2017 at 11:48:33 AM UTC-7, Andreas Kohlbach wrote:
> On Thu, 23 Mar 2017 18:00:42 -0700 (PDT), Jimmy Mac wrote:
> >
> > I've struggled to find much in the way of solid documentation on how
> > to get tcpser to autostart on the Raspberry Pi.
>
> Why? Does your BBS need this?
>
Yep. Going old-school with a physical Commodore C64. Thanks for the tips.

Jimmy Mac

unread,
Mar 30, 2017, 2:21:51 PM3/30/17
to
On Saturday, March 25, 2017 at 2:23:05 AM UTC-7, Drew Klenotic wrote:

>
> Why re-invent the wheel? http://www.particles.org/particlesbbs/ is a
> C128 BBS on "the net". This guy is probably one of the best examples of
> a great old school retro BBS. He literally has more activity in a day
> than I have in weeks. He's the guy we're all wishing we were.
>
> Check in with him. I'm sure he'd be happy to help. If not, I'd be happy
> to help (I'm an Atari guy, but the basic principles are the same).
>
> Also on Facebook. https://www.facebook.com/particlesbbs/

Not really trying to re-invent, more like adding a Buggy hub & spoke wheel on a VW :-)

I haven't called Particles yet but will certainly do so in the future.
J..

CBMGuy

unread,
Mar 30, 2017, 2:44:58 PM3/30/17
to
If you use the Zero with a headless Raspbian, than it will work perfectly; fast, responsive, and boot quickly. I used an older 2011 Model B (which is practically the same as the Zero) with the above project and it works great.

If you would rather have the more thought out text file I wrote, then let me know and I'll post it or send it or whatever... It's bothering me so I probably will just repost the complete and corrected instructions here... It make much more sense than the semi-babble-blog instructions above.

Worth noting, the MAX232 will work every time. The USB to Serial adapters are not all the same and many work while many other adapters will not... It's worth spending the $1.50 on a MAX232 and just get it done without the headaches.

Cheers,
Carl

CBMGuy

unread,
Mar 30, 2017, 2:48:34 PM3/30/17
to
Ya, the previous post is bugging the hecj out of me and I really don't want ppl to be frustrated if they follow it. Here's a more easy to follow procedure without the missing parts. It also includes a wifi part that will help in making a wifi Pi easier to setup, as well.

Sorry for the double posting and such... Such an 80's thing to do!




Emulating a serial modem on a Raspberry Pi
C. Reilly 30MARCH2017

This quick little project will provide a serial to tcp/ip bridge for a Raspberry Pi LINUX using tcpser and a MAX232 (or a USB to Serial adaptor). TCPSER will emulate the important Hayes commands needed to connect to telnet BBSs.

It's a great way to BBS again. Can be used from the UserPort or a swiftlink/turbo 232 and even stand up a Q-Link server and connect to it with real hardware.

TOC
---
Manditory Step - Setting up the environment properly
Step 1 - Connecting the MAX232 (if you are using a USB to Serial adaptor, skip this step)
Step 2 - Automating tcpser to start when booting the Pi
Step 3 - Setting up a wireless Pi connection without a GUI
---


Manditory Step - Setting up the environment
---
First, install Raspbian onto your Pi. I use a headless version of raspbian LINUX making it pretty light weight, fast booting and responsive. Connect an active ethernet cable and make sure you have a network connection.

Default Username: pi
Default password: raspberry



Second, note the IP address of your Pi. This is used to access the Pi for programming and maintenance. I use my router to provide the IP address and from there, I use PuTTY to telnet into the Pi to perform the rest of these instructions.

If you cannot find the IP address, connect a keyboard and a monitor to the Pi and once it's booted, logon using the default username and password to get to a bash.

Type: ifconfig eth0

Record the IP address. I recommend disconnecting the keyboard and monitor from the Pi before proceding and just remote into the Pi using PuTTY or your favourite telnet client.

If you are using a USB wireless 802.11 connection, see Step 3 to get that working. The wifi is a pretty slick way of using this project, BTW. Power can be taken from the cassette, joyport, etc. and the Pi can be tucked out of the way, giving your computer a lot more freedom and remaining tidy.



Third, install tcpser. At the bash:

type: sudo apt-get install tcpser


**Worth noting, you can use a number of USB to Serial adaptors to allow more than one baud rate/computer to be connected. The expense of power might be an issue, but it will work perfectly fine with multi tcpser commands pointing to specific ttyYUSB hardware.





Step 1 - Connecting the MAX232 (if you are using a USB to Serial adaptor, skip this step)
---
I have an old Raspberry Pi Model B and a MAX232 serial 9pin board for the Pi (it's about $1.50 for the MAX232 from ebay--I have a number of these already which is why I used them for this project). The MAX232 is connected to the Pi's GPIO port. To use the port properly, you need to disable the Pi's default setting that takes control of the poirt to monitor for remote logons. To do that, do the following:

To setup the Pi's GPIO header for serial and disable remote logon monitoring, at the bash:

Type: sudo raspi-config

Select option 5 from the menu, then select Serial from that menu. Choose No to the "login shell over serial". Then yes to "enabling the serial port hardware". While I was in there, I also overclocked the Pi, but if power is an issue, you may want to skip that suggestion. Exit out of the tool and back to the bash. There's no need to reboot the Pi.

Using the four patch wires that come with the MAX232, physically wire it to the Pi's GPIO as follows:

MAX232 Pi GPOI
------ -------
Vcc <---------> 3.3V pin 2
GND <---------> GND pin 6
Tx <---------> Rx pin 10
Rx <---------> Tx pin 8



Step 2 - Setting up the Pi to automate tcpser on boot:
---
Two text files need to be created. One is the executable file that has the instructions to start tcpser with our default values and another text file that instructs LINUX how to start the first file as a bootable service.

1. Create a text file (I just put it in the Pi home directory) and make it executable. If you are using a USB to Serial Adaptor, change the ttyAMA0 to ttyUSB0 in the following instructions (or the ttyUSB# that represents where your adaptor is active using the command: lsusb -t at the bash). Change the 38400 baud rate value in the tcpser line to whatever suites your setup.

To create the proper text file, at the bash:

type: cd <Enter>
type: vi serialBridge <Enter>
type: i
type: #!/bin/sh <Enter>
type: tcpser -s 38400 -d /dev/ttyAMA0 &
type <Esc>:wq <Enter>

You're now out of the editor and back at the bash. If you do an ls command, you should see the new file, serialBridge, in the directory. We now need to make the file executable. At the bash:

type: chmod +x serialBridge

2. Now that we have an executable file to start up tcpser with our default values, we need to create another text file that instructs LINUX how to start that file as a service when the OS boots. To do that, we create another text file in a very specific spot and then issue some commands to tell LINUX to use it when it's booting. To do that, at the bash:

type: sudo vi /lib/systemd/system/serialBridge.service <Enter>
type: i

copy and paste everything between the # mark lines into the editor (or type it in if you are a better typer than myself):

####################
[Unit]
Description=Serial to TCP-IP Bridge
After=Multi-User.target

[Install]
WantedBy=Multi-user.target

[Service]
ExecStart=/home/pi/serialBridge
type=forked
#####################

You're still in the editor at this point, so to save and exit the editor type the following: <Esc>:wq <Enter>

You will now be out of the editor and at the bash prompt. To register the executable as a service and start up the service immediately (no need to reboot), at the bash:

type: sudo systemctl enable serialBridge.service
type: sudo systemctl start serialBridge.service
type: sudo systemctl status serialBridge.service

The first command will instruct LINUX the service should be enabled at boot (level 3). The second command will tell LINUX to start the service right now (so we can use it right away without having to reboot everything). The third command will display the status of the service we just started with the previous command so we can see if it's actually enabled and ready to use. If there is a "disabled" status, then you need to go back and check your typing or if the proper device is being used, etc. If you are using a USB to Serial, the USB0 might have to be changed to ttyUSB1, etc (check to see which one is active).

Physcially connect the MAX232 to your PC with a proper cable. Turn on your PC, fire up a terminal, set the proper baud rate, and enter ATDT followed by the telnet DNS:port. Spank the Return key and see if anything connects and works as expected. I had to disable flow control to work properly, but I believe that's my cable that I was using causing that issue.

Step 3 - Using a Wireless USB 802.11 Adaptor
To connect to your secure wireless network you need to connect a keyboard and monitor to your Pi and perform the following:

type: sudo vi /etc/wpa_supplicant/wpa_supplicant.conf

**Below, wifiName refers to the name of the wifi you are connecting to. wifiPassword is the password you use to connect to your wifi. Include the quotes in your changes below.

Cursor to the bottom of the file:

type: i
type:

network={ ssid="wifiName" psk="wifiPassword"}

now type:
<Esc>:wq<Enter>

You should now be at the bash again. After a couple of moments, the wireless network should be working. It might take a few moments since the Pi has to notice the change you just made and the wifi negotiations need to finish up. It should not take any longer than 5 minutes (2 minutes is a long enough wait, IMHO).

If security is an issue and you do not want your wifi password in plain text like that, then at the bash:

type: sudo wpa_passphrase "wifiName" "wifiPassword"

This will output the encrypted psk token. Replace the psk="wifiPassword" in the wpa_supplicant.conf text-file with the token (this time without the quotes) that was produced with the above command.

Cheers,
Carl

Dropnine

unread,
Apr 6, 2017, 8:43:36 PM4/6/17
to
On Thursday, March 30, 2017 at 12:48:34 PM UTC-6, Dropnine wrote:

I was asked to correct a part that will stop you from automating tcpser on boot. The error is in the type portion of the serialBridge.service text file.

It should be Type=forking. If it's anything else, LINUX will end the thread because it considers the script to have run and maintain its own PID.

Sorry for the error. The serialBridge.service file should look like below.

Edit your original or just type "rm /lib/systemd/systemserialBridge.service" to remove the old file and remake it by doing the following:

type: sudo vi /lib/systemd/system/serialBridge.service <Enter>
type: i

Copy and paste everything between the # mark lines into the editor (or type it in if you are a better typer than myself):

####################
[Unit]
Description=Serial to TCP-IP Bridge
After=Multi-User.target

[Install]
WantedBy=Multi-user.target

[Service]
ExecStart=/home/pi/serialBridge
Type=forking
#####################


.... Cheers

Dropnine

unread,
Apr 6, 2017, 9:31:33 PM4/6/17
to
And... if you're still having an issue, add: Restart=on-abort
after the Type=forking entry.

If you are using a stand-alone lite raspian on your pi, editing the /etc/rc.local file and putting the the tcpser command before the "exit 0" line will also accomplish the autostart on boot. The rc.local file is read-only so you'll need to change the permissions.

Seems to be a few flavours of raspian out there or something is going bonkers... Many ways to do an autoboot, as you can see.

Dropnine

unread,
Apr 7, 2017, 11:20:23 AM4/7/17
to
Step 2 - Making TCPSer a service that boots with the Pi
---
(Edit 5APR2017:
- corrected the .service file contents
- added file permissions to allow tcpser to execute and stay resident at boot
)

So I had a number of pm's stating that their Pi's were not working with the instructions. the service would start manually, but not autostart. This worked fine with my old version of noobs, however I did notice that the latest raspian lite img was, indeed breaking with the previous instructions. The target I set out from in the beginning is to have tcpser run as a *service*. This gives the OS much more flexibility and is not a hack.

I was asked to explain, why make it into a service. There are a number of reasons, but in short, a service is meant to continue on in the event of an error and not stop. The error is directed to a log and you can inspect the status at a level which is approachable. We can check the status of the service with a -l command and it will give us direct info of the error that accurred and we can investigate and correct the error, etc. quickly--which is always the case in my job. It's just a good habit and best practice to get into so that it is much less frustrating.

** You can hack the rc.local file and enter the tcpser command into that to make it autoboot -- make sure you include the & at the end of the command or you'll never get to a login prompt. That is just one issue that may occur when the system hangs at boot. That file is read-only for a reason...but you can use it. There will also be no indication as why the application does not work when it fails and that is a total misery to work through.

** Alternatively, you can also move the serialBridge file into the /etc/init.d/ directory and than issue some commands to enable it; this is more of a brute force sort of approach and requires some programming to do it properly.


So here's the final version and I know this to work as I recreated it last night. I obtained the raspbian lite image and wrote the image to a 4GB SD card. I then booted the Pi, setup my max232 and the GPIO as in step 1. I then installed tcpser as in the mandetory step from the previous instructions. I then went on to document the steps below. I then did the whole process again, this time working from the document below to confirm it was proper.

----
Here is the edited STEP 2 instructions to create tcpser as a service on LINUX (make sure the other steps are followed before going forward with this):

Two text files need to be created. One is the executable file that has the instructions to start tcpser with our default values and another text file that instructs LINUX how to start the first file as a bootable service.

1. Create a text file (I just put it in the Pi home directory) and make it executable. If you are using a USB to Serial Adaptor, change the ttyAMA0 to ttyUSB0 in the following instructions (or the ttyUSB# that represents where your adaptor is active using the command: lsusb -t at the bash). Change the 38400 baud rate value in the tcpser line to whatever suites your setup. The max232 that I have can go from 300 baud to 115200 baud. There are some that cannot go any lower than 57600, so please make sure you know your type. USB to serial devices are known to be very bad and buggy. Use them at your own risk. My advice is to purchase a USB-Serial device that is more than 10 bucks CDN.

To create the proper text file, at the bash:

type: cd <Enter>
type: vi serialBridge <Enter>
type: i
type: #!/bin/sh <Enter>
type: tcpser -s 38400 -d /dev/ttyAMA0 &
type <Esc>:wq <Enter>

You're now out of the editor and back at the bash. If you do an ls command, you should see the new file, serialBridge, in the directory. We now need to make the file executable. At the bash:

type: chmod +x serialBridge

2. Now that we have an executable file to start up tcpser with our default values, we need to create another text file that instructs LINUX how to start that file as a service when the OS boots. To do that, we create another text file in a very specific spot and then issue some commands to tell LINUX to use it when it's booting. To do that, at the bash:

type: sudo vi /lib/systemd/system/serialBridge.service <Enter>
type: i

Copy and paste everything between the # mark lines into the editor (or type it in if you are a better typer than myself):

####################
[Unit]
Description=Serial to TCP-IP Bridge
After=Multi-User.target

[Install]
WantedBy=Multi-user.target

[Service]
ExecStart=/home/pi/serialBridge
Type=forking
Restart=on-abort
#####################

You're still in the editor at this point, so to save and exit the editor type the following: <Esc>:wq <Enter>

You will now be out of the editor and at the bash prompt. To register the executable as a service and start up the service immediately (no need to reboot), at the bash:

type: sudo chmod 644 /lib/systemd/system/serialBridge.service <ENTER>

type: sudo systemctl daemon-reload
type: sudo systemctl enable serialBridge.service <ENTER>
type: sudo systemctl start serialBridge.service <ENTER>
type: sudo systemctl status serialBridge.service <ENTER>

The first command will reload the daemon server to acknowledge the new changes. The second command will instruct LINUX the service should be enabled at boot (level 3). The third command will tell LINUX to start the service right now (so we can use it right away without having to reboot everything). The forth command will display the status of the service we just started with the previous command so we can see if it's actually enabled and ready to use. If there is a "disabled" status, then you need to go back and check your typing or if the proper device is being used, etc. If you are using a USB to Serial, the USB0 might have to be changed to ttyUSB1, etc (check to see which one is active).

If your service is not active, then at the bash:

type: sudo systemctl status serialBridge.service -l <ENTER>

and look to see what the issue is. More than likely it'll be a spelling mistake or something simple.

Contact me like before if there are wierd issues with your Pi and these instructions.

Jimmy Mac

unread,
Apr 12, 2017, 4:35:15 PM4/12/17
to
On Friday, April 7, 2017 at 8:20:23 AM UTC-7, Dropnine wrote:
> Step 2 - Making TCPSer a service that boots with the Pi

Thank you!!

I really appreciate the detailed steps.

Jim..

6502en...@gmail.com

unread,
Jun 11, 2017, 2:13:17 AM6/11/17
to
Hi,

I do have a similar problem with tcpser and the Raspberry PI.

Excuse - it is about a connection between the PI and an Apple II :-) ... hope that's also ok here.

The problem is that tcpser works, but after about 10-20 hours it shuts down. The Terminal Window is still open and I can start it again. Then it is working all right but the same shutdown again after the same time?

My setup:

Raspberry PI 2 Model B
Debian
Raspberry WiFi Stick
USB to serial adapter (USB0)
tcpser
Apple II connected to serial adapter

I installed tcpser with:

sudo apt-get install tcpser

Started tcpser with:

tcpser -s 2400 -d /dev/ttyUSB0 -p 6502 -ts -B /scripts/busy.txt -N /scripts/offline.txt

As said, tcpser is running well, I can telnet to my Apple II - everything works fine. But after a few hours the connection in the Terminal Window is shut down. I start it again - working fine - after a few hours the same?

Thanks for any help!

Andreas Kohlbach

unread,
Jun 11, 2017, 3:40:48 PM6/11/17
to
Is there a (error) message in the terminal?

If not you could also add "-l 7" which puts out maximal logging messages.
--
Andreas
You know you are a redneck if
there are more fish on your wall than pictures.

6502en...@gmail.com

unread,
Jun 12, 2017, 2:15:11 AM6/12/17
to
Thanks for your help!

No, I get no error message.

I tried to put in -I 7 (tcpser -s 2400 -d /dev/ttyUSB0 -p 6359 -ts -I 7 -B /scripts/busy.txt -N /scripts/offline.txt) - but this leads to another problem: if I try to connect with telnet, the connection to the Apple II is made but closed immediately ...

mark lewis

unread,
Jun 12, 2017, 4:24:57 AM6/12/17
to

On 2017 Jun 11 23:15:10, you wrote to All:

en> I tried to put in -I 7

ummm... that should be a lowercase ell... ell for logging ;)

)\/(ark

Always Mount a Scratch Monkey
Do you manage your own servers? If you are not running an IDS/IPS yer doin' it
wrong...
... We are ready for an unforeseen event that may or may not occur.

6502en...@gmail.com

unread,
Jun 12, 2017, 4:45:05 AM6/12/17
to
Ohh, thanks!

OK that started working good - let's see how long it will last ...

6502en...@gmail.com

unread,
Jun 20, 2017, 3:45:03 AM6/20/17
to
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

Dropnine

unread,
Jun 20, 2017, 3:47:39 PM6/20/17
to
On a linux flavour of tcpser:

What log level do you tcpser running at? And is it tracing? Turning logging to verbose/debug (-l 7) and trace some things with the -tis. Force tcpser to dump its output to a file with > output.txt

ie:
tcpser -d /dev/ttyS0 -s 38400 -l 7 -tsSiI > output.txt

You might need to add &1>2 to the end of out output.txt (not too sure since I don't have access to my stuff atm).

Let it run and when it fails, check the output.txt for what happened.

You can also tail the tcpser and see the info as tcpser is running in realtime.

Cheers,
c

Dropnine

unread,
Jun 20, 2017, 3:52:34 PM6/20/17
to
Just looked at the pic (making that other reply probably repetitive lol sorry) Looks like the socket disappeared. Perhaps there's another service running that is stealing the device or perhaps tcpser is just a little buggy... My two cents.

Dropnine

unread,
Jun 20, 2017, 3:56:31 PM6/20/17
to
On Tuesday, June 20, 2017 at 1:45:03 AM UTC-6, 6502en...@gmail.com wrote:
As a hardware solution, how is the pi being powered? From a USB port or from a walled 5V 1A transformer? What is the serial device being used, GPIO or USB to serial?

6502en...@gmail.com

unread,
Jun 21, 2017, 2:09:36 AM6/21/17
to
Thanks for the help!

The PI is being powered by a 5V 1A transformer.

It is connected via a USB to serial adapter to the serial port of a Apple IIe.

Dropnine

unread,
Jun 21, 2017, 2:51:02 PM6/21/17
to
The USB to serial are known to be sort of flaky... Saying that, the hardware should be powered fine with that power source you have.

If you set it up as a service, it should restart automatically if you told it to in the service file.

To find out if tcpser is still running after it craps out, at the bash type:
ps -ef | grep tcpser

If the resulting list displays that it is still running, then kill it by its PID. Don't confuse the "grep tcpser" in the list as the tcpser command, itself.

If it is not running, then I'd write a quick script that will perform that ps command above and if tcpser does not exist, then start it. Put an entry in your CRON to run that script every 5 minutes or quicker.

Still, the best practice would be to make a tcpser service and tell the service to restart on termination.

Andreas Kohlbach

unread,
Jun 21, 2017, 4:40:43 PM6/21/17
to
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 <http://hackaday.com/2017/06/17/bbsing-with-the-esp8266/>. 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] <https://www.youtube.com/watch?v=fsS0E4G310Y>
--
Andreas
You know you are a redneck if
you ever lost a loved one to kudzu.

Dropnine

unread,
Jun 21, 2017, 11:06:24 PM6/21/17
to
#!/bin/sh

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

if [ "${RESULT:-null}" = null ]; then
tcpser <yourParameters>
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_wifi_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 <esc> 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 <Enter>.

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 <CTRL-X>, then Y and finally your <Enter> 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

Dropnine

unread,
Jun 21, 2017, 11:12:37 PM6/21/17
to
On Wednesday, June 21, 2017 at 9:06:24 PM UTC-6, Dropnine wrote:
...
> Now, create a file that will be your script. At the bash:
> type: cd
> type: startSerial
...

That should read
type: cd
type: vi startSerial
type: i

Something happened when I posted that and it added a script I wrote at the beginning of the replay and then omitted the above. Sorry about that random interweb gremlin attack on my post.

Dropnine

unread,
Jun 22, 2017, 1:10:55 AM6/22/17
to
Instead of piecing together the posts and the corrections because of my adhd, I put them here to be easily retrieved as a whole.

https://drive.google.com/drive/folders/0B7Y4Lsah28nCem54WnBWYkZ5LTQ

Cheers
c

mark lewis

unread,
Jun 22, 2017, 4:12:02 PM6/22/17
to
On 2017 Jun 21 11:50:38, you wrote to 6502en...@gmail.com:

Dr> If the resulting list displays that it is still running, then kill it
Dr> by its PID. Don't confuse the "grep tcpser" in the list as the tcpser
Dr> command, itself.

a little trick to avoid seeing the "grep" line in the output...

ps -ef | grep [t]cpser

;)

)\/(ark

Always Mount a Scratch Monkey
Do you manage your own servers? If you are not running an IDS/IPS yer doin' it
wrong...
... "This chicken has no beak," said Tom impeccably.

6502en...@gmail.com

unread,
Jun 23, 2017, 4:55:55 AM6/23/17
to
Hi,
Thanks a lot for all your help!

To explain: I use a Apple IIe for a BBS. Therefor the PI with tcpser acts as a „modem“. So the BBS is reachable via telnet.

I do have a WiFi232 - great tool - I use it to „dial-up“ other BBS with a Apple II+. But I don’t want to purchase a second one , because I have the Raspberry PI 2B and want it to make my BBS connectable via telnet. That worked fine so far - only the mentioned problem …

As I understood correctly I have to do the following to
- make a tcpser service
- That restarts every minute to avoid my problem of tcpser being stopped

1.)
Create a file that will be your script. At the bash:
type: cd
type: vi startSerial
type: i

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 2400 -d /dev/ttyUSB0 &
************

2.)
now save and quit the editor by:
Press the <esc> key
type: :wq

3.)
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 <Enter>.

4.)
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 <CTRL-X>, then Y and finally your <Enter> 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.

———————

Where do I have to put the mentioned:

a little trick to avoid seeing the "grep" line in the output...

  ps -ef | grep [t]cpser

in?


Thanks!

Dropnine

unread,
Jun 23, 2017, 10:45:49 AM6/23/17
to
On Friday, June 23, 2017 at 2:55:55 AM UTC-6, 6502en...@gmail.com wrote:
> Hi,
> Thanks a lot for all your help!
....
> ———————
>
> Where do I have to put the mentioned:
>
> a little trick to avoid seeing the "grep" line in the output...
>
>   ps -ef | grep [t]cpser
>
> in?
>
>
> Thanks!

That line is just another way of seeing if tcpser is actually running or not without the clutter. You would use that directly at the bash (command prompt) when ever you want to.

In saying that, it's easy to say that there are many many many ways to do one thing lol And that, alone, makes things convoluted and starts many opinions boiling over as to what is the best practice.

So, to start tcpser on boot and to keep it running, you can make it into a server (the proper way I would do it, allowing) *OR* create a timer (just as good as a service, but approached more in the way of an application running on top of the OS rather than within it). It depends on how your brain is used to thinking and whether/what you want to know. The timer requires your own maintenance to be set up (which we did with the script to check it) or letting the OS take care of it all (which is what the service would do).

Cutting to the chase and getting it done in the least amount of steps and a first crack at it, I would make a timer and then use the @reboot command. Quick, done, and it works: It will autoboot and keep running when it crashes and its process quits.

I also agree with keeping the Pi. I'm in the same bought with a bunch of original 2011 pi's that work great for this purpose. I prefer the max232 and GPIO hardware route, but each to there own :) Working with this stuff makes it all feel like 1984 again :)

Cheers,
Carl



Janne Johansson

unread,
Jun 23, 2017, 11:05:34 AM6/23/17
to
On 2017-06-22 21:29, mark lewis : Dropnine wrote:
>
> On 2017 Jun 21 11:50:38, you wrote to 6502en...@gmail.com:
>
> Dr> If the resulting list displays that it is still running, then kill it
> Dr> by its PID. Don't confuse the "grep tcpser" in the list as the tcpser
> Dr> command, itself.
>
> a little trick to avoid seeing the "grep" line in the output...
>
> ps -ef | grep [t]cpser
>

Or just use "pgrep" which saves you the pipe and the tricks.

Dropnine

unread,
Jun 23, 2017, 11:19:06 AM6/23/17
to
On Friday, June 23, 2017 at 9:05:34 AM UTC-6, Janne Johansson wrote:
....
> Or just use "pgrep" which saves you the pipe and the tricks.

lol. That's another way yup. Again, you'd use that just at the bash as a command in respect to the how-to's provided.

6502en...@gmail.com

unread,
Jun 26, 2017, 11:32:58 AM6/26/17
to
Thanks for your help!

Well, I did all 4 steps, but so far I get always the 0 and not the 1 when I type: ps x |grep -v grep |grep -c "tcpser" ... Especially I made sure that I set the startSerial file to execute with chmod +x ...

I would like to delete the file in script with:
***************
#!/bin/sh

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

if [ $RESULT = 0 ]; then
tcpser -s 2400 -d /dev/ttyUSB0 &
***************
because I have an empty first row above that - maybe here is the mistake?

With what order can I delete the script?

----------------

Towards the WiFi232 - on the BBS - A 80's Apple II BBS ( Telnet: a80sappleiibbs.ddns.net:6502 ) is a discussion about how to host a BBS with the WiFi232 - so far the BBS Software GBBS Pro moves not into answer mode if the Apple II is connected to the WiFi232 - with the Raspberry PI this works without any problems ...

Dropnine

unread,
Jun 26, 2017, 2:45:48 PM6/26/17
to
On Monday, June 26, 2017 at 9:32:58 AM UTC-6, 6502en...@gmail.com wrote:
> Thanks for your help!
>
> Well, I did all 4 steps, but so far I get always the 0 and not the 1 when I type: ps x |grep -v grep |grep -c "tcpser" ... Especially I made sure that I set the startSerial file to execute with chmod +x ...
>
> I would like to delete the file in script with:
> ***************
> #!/bin/sh
>
> RESULT=`ps x |grep -v grep |grep -c "tcpser"`
>
> if [ $RESULT = 0 ]; then
> tcpser -s 2400 -d /dev/ttyUSB0 &
> ***************
> because I have an empty first row above that - maybe here is the mistake?
>
> With what order can I delete the script?
>
> ----------------


Hi. I would think that your CRON is not running or there is something up with the timing job that was entered (That's just a guess). *Make sure that your pi is updated with sudo apt-get update and then sudo apt-get upgrade.

There's a couple of ways to get a picture of what's going on, the first thing is to turn on the cron logging and then look at it's log with the command: less /var/logs/cron.log and see what it is reporting. And then go to correct the spelling or whatever the cause is. Check the doc under "debugging the cron timer" to see how to turn it on.

Another approach is to see if the script,itself, is working. Manually issue the script command with ./startSerial (if that's the name you called your script). Perhaps you never made the text file executable.

Finally, if the script is working, bypass it and manually type: tcpser -s 2400 -d /dev/ttyUSB0 &

at the bash and then issue a "ps -A" the tcpser should be in the list near the bottom. If it is, then issue the ps -x | grep -v grep |grep -c "tcpser" command manually to see the result. That should tell you if the tcpser command is working, itself.

Dropnine

unread,
Jun 26, 2017, 2:50:57 PM6/26/17
to
PS: the script should only contain the following:

#!/bin/sh

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

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


Nothing more.

I put the script into a file in the directory. If you need it, you can copy it directly to your pi with a wget command.

CVh

6502en...@gmail.com

unread,
Jun 28, 2017, 9:27:01 AM6/28/17
to
Am Montag, 26. Juni 2017 20:45:48 UTC+2 schrieb Dropnine:

> Finally, if the script is working, bypass it and manually type: tcpser -s 2400 -d /dev/ttyUSB0 &
>
> at the bash and then issue a "ps -A" the tcpser should be in the list near the bottom. If it is, then issue the ps -x | grep -v grep |grep -c "tcpser" command manually to see the result. That should tell you if the tcpser command is working, itself.

OK, I've done the following:

- wrote "tcpser -s 2400 -d /dev/ttyUSB0 -p 6502 -ts &"
- then ps -A
- and ps -x | grep -v grep |grep -c "tcpser"

(I needed to enter the port 6502 - otherwise there was no connection to the apple II because I set that port for the telnet address which is: a80sappleiibbs.ddns.net:6502 . Without the -ts there was no connection made - I do not know why.)

I saw tcpser down in the list.
I got the 1.
All is running now.

I don't know if the script is working. I named it startSerial, made everything as you said - but if I type "./startSerial" I get the result "unknown error in line 8" ...?

Now I will see if tcpser stops again or if it is running well ...

Thanks a lot for all of your help!

Dropnine

unread,
Jun 28, 2017, 10:49:23 AM6/28/17
to
On Wednesday, June 28, 2017 at 7:27:01 AM UTC-6, 6502en...@gmail.com wrote:

....
> I saw tcpser down in the list.
> I got the 1.
> All is running now.
>
> I don't know if the script is working. I named it startSerial, made everything as you said - but if I type "./startSerial" I get the result "unknown error in line 8" ...?
>
> Now I will see if tcpser stops again or if it is running well ...
>
> Thanks a lot for all of your help!

Line 8 has an error in it. If the cron job is running, it will never restart the tcpser application because it relies on the script to start it :( Check line 8 and make sure it's proper--there's a mistake of some kind on that line.

mark lewis

unread,
Jun 28, 2017, 11:29:09 AM6/28/17
to

On 2017 Jun 28 06:26:58, you wrote to All:

en> I don't know if the script is working. I named it startSerial, made
en> everything as you said - but if I type "./startSerial" I get the result
en> "unknown error in line 8" ...?

the script cannot work if it is erroring out... we cannot tell what the error
is without seeing the script... you know what to do next, right? ;)

)\/(ark

Always Mount a Scratch Monkey
Do you manage your own servers? If you are not running an IDS/IPS yer doin' it
wrong...
... Timing has an awful lot to do with the outcome of a rain dance.

6502en...@gmail.com

unread,
Jun 28, 2017, 12:19:47 PM6/28/17
to
:-) ... I know ... here are the pics:

The script:

https://s18.postimg.org/xki8l2byx/Full_Size_Render.jpg

Screen after ./startSerial:

(correct translation is: Syntax Error: unexpected end of file

https://s13.postimg.org/is0zi1yzb/IMG_3763.jpg

mark lewis

unread,
Jun 28, 2017, 12:57:00 PM6/28/17
to

On 2017 Jun 28 09:19:44, you wrote to All:

en> :-) ... I know ... here are the pics:

you do realize that pasting the actual text into a message would have been
smaller and easier, right? ;)

en> (correct translation is: Syntax Error: unexpected end of file

yeah, "if" statements end with "fi"... you don't have one...


if [blah blah ] ; then
do something
fi



)\/(ark

Always Mount a Scratch Monkey
Do you manage your own servers? If you are not running an IDS/IPS yer doin' it
wrong...
... I plead not guilty by reason of computer-induced insanity.

6502en...@gmail.com

unread,
Jun 28, 2017, 1:50:54 PM6/28/17
to
Thanks a lot!

It seems that all is now working!

I've put the "fi" in and then at the prompt I typed "./startSerial" - and then tcpser started. So I hope that CRON Table is now also working and will start the startSerial script if tcpser stops again.

Dropnine

unread,
Jun 28, 2017, 5:08:06 PM6/28/17
to
....

Interesting. The fi on mine is only required when there's an else included with the if/then...

To check if the cron is working, check the log or kill the tcpser service or just restart the pi and check to see if it loads up.

Cheers,
c

Janne Johansson

unread,
Jun 29, 2017, 4:11:07 AM6/29/17
to
On 2017-06-28 05:26, 6502en...@gmail.com : All wrote:
> Am Montag, 26. Juni 2017 20:45:48 UTC+2 schrieb Dropnine:

> OK, I've done the following:
>
> - wrote "tcpser -s 2400 -d /dev/ttyUSB0 -p 6502 -ts &"
> - then ps -A
> - and ps -x | grep -v grep |grep -c "tcpser"
>

I didn't want to turn this into a "my oneliner is better than yours",
but unix shells makes this rather simple:

pgrep tcpser || tcpser -s 2400 -d /dev/ttyUSB0 -p 6502 -ts &

which basically means,

"if tcpser is not found among the list of running programs, run it again"

or even more verbose explanation:

pgrep <name of program>
will return an "ok" exit code if found, and error code if not.

the || double-pipe means "if error, run stuff behind ||, else skip"
which is the opposite of the more common && operator which means
"run the stuff behind && only if previous command went well" mostly
used to make sure each step of a long series of commands worked and not
continue otherwise.

So, all in all, pgrep for the program, if not found, pgrep will signal
that it failed its mission to find tcpser in the process list, and runs
the command after, which incidentally is the full tcpser command again.

Since pgrep is rather cheap to execute, you could just run this as often
as you like, even in a loop like this:

while sleep 1
do
pgrep tcpser || tcpser ...
done

If this is in rc.local and you want that script to exit, use shell ()
feature (called 'subshell') and place that one into the backgroup with a
single &.

( while sleep 1
do
pgrep ...|| ..
done
) &

and you have yourself a daemon style script that checks for tcpser every
second (every sleep X interval) and restarts it asap if its gone.

Dropnine

unread,
Jun 29, 2017, 9:20:00 AM6/29/17
to
On Thursday, June 29, 2017 at 2:11:07 AM UTC-6, Janne Johansson wrote:
>
> pgrep tcpser || tcpser -s 2400 -d /dev/ttyUSB0 -p 6502 -ts &
>
> which basically means,
>
> "if tcpser is not found among the list of running programs, run it again"
>

That rocks too. "100 ways to skin a cat" as they say. I still personally prefer such things to be a service and let OS all takes care of itself without the hacking of the rc. But it's fun hacking around with the stuff, that's for sure. There's probably another 10 ways out there to do it. If they're centralized here then they're easy to find all in one spot :) If there's other ways, share 'em.

Cheers,
c

6502en...@gmail.com

unread,
Jun 29, 2017, 1:43:40 PM6/29/17
to
Great! I typed that also in - why not a second door to make tcpser run if it stops.
Thanks a lot!

6502en...@gmail.com

unread,
Jul 5, 2017, 9:51:55 AM7/5/17
to
OK - the problem is not solved so far ...

Tcpser run now for a few days well.

Then it stopped again.

I typed:ps x |grep -v grep |grep -c "tcpser"

The result was: 0

Tcpser was also not started by CRON after a few minutes ...

Then I typed: ./startSerial

Tcpser started. At the moment it is running, but I don't know why it is not startet by CRON automatically, because the script seems to work good...?

mark lewis

unread,
Jul 5, 2017, 11:12:14 AM7/5/17
to

On 2017 Jul 05 06:51:52, you wrote to All:

en> Tcpser was also not started by CRON after a few minutes ...

en> Then I typed: ./startSerial

en> Tcpser started. At the moment it is running, but I don't know why it is
not
en> startet by CRON automatically, because the script seems to work good...?

where, exactly, is your script?
what, exactly, is your cron entry?

)\/(ark

Always Mount a Scratch Monkey
Do you manage your own servers? If you are not running an IDS/IPS yer doin' it
wrong...
... The four seasons: onions, celery, bell pepper, and garlic.

Janne Johansson

unread,
Jul 5, 2017, 11:23:37 AM7/5/17
to
On 2017-07-05 16:54, mark lewis : 6502en...@gmail.com wrote:

> en> Tcpser was also not started by CRON after a few minutes ...
>
> en> Then I typed: ./startSerial
>
> en> Tcpser started. At the moment it is running, but I don't know why
> it is not
> en> startet by CRON automatically, because the script seems to work
> good...?
>
> where, exactly, is your script?
> what, exactly, is your cron entry?

A common "problem" is that cron is run with a conservative PATH env.
variable, so it will not find the same commands as you do when you have
logged in interactively, so giving full path to stuff in /usr/local or
placed otherwise in "strange" locations (basically anything except
/bin,/sbin,/usr/bin,/usr/sbin) is more or less a must for cron jobs.

6502en...@gmail.com

unread,
Jul 5, 2017, 1:23:22 PM7/5/17
to
"Where, exactly, is your script?"

- well, I don't know. How can I find that out?

"What, exactly, is your cron entry?"

- At the bash I typed: "crontab -e"
- then I selected "nano" as editor
- then I typed into the last line:" */1 * * * * /home/pi/startSerial"
- then I pressed:"<CTRL-X>"
- then "Y"
- then "Return"

--------------------
"so giving full path to stuff in /usr/local or
placed otherwise in "strange" locations (basically anything except
/bin,/sbin,/usr/bin,/usr/sbin) is more or less a must for cron jobs."

You mean it should be saved in /usr/local ? How can I save it there? As described above, nano offers just to save it with "<CTRL-X>".

Thanks for your help!

Dropnine

unread,
Jul 5, 2017, 3:35:47 PM7/5/17
to
The /home/pi/startSerial you've entered explicitly tells cron to run the startSerial script in the /home/pi directory. there is nothing else it will try or guess. That script obviously works fine as when you run it manually, it works. So your attention should be on the CRON job. That line may not be proper and you might want to copy the line from the text and then copy it into the editor then save it the file. That is a guess at this point. Ther eis no need to copy that script anywhere else.

CRON does have a log file, but you need to turn it on. the log file is placed in the /var/logs directory under the name cron. you can inspect that file and then you will know what the issue is. The info to turn on the cron log is at the end of the document.

*When running against a timer, it is best to use CRON, always, not an endless loop in a script -- that is very bad practice as scripts are meant to run and then stop and then they are envoked again when needed.

* I will make an image of my pi's sd and you can just write that to your flash card and just get it done. I am teaching this evenning so I might not be able to get to it until tomorrow if that's OK. It will be located in the shared folder and publically avalaible.

Best of luck :)
Cheers,
c

Andreas Kohlbach

unread,
Jul 5, 2017, 5:29:08 PM7/5/17
to
On Wed, 5 Jul 2017 06:51:53 -0700 (PDT), 6502en...@gmail.com wrote:
>
> OK - the problem is not solved so far ...
>
> Tcpser run now for a few days well.
>
> Then it stopped again.
>
> I typed:ps x |grep -v grep |grep -c "tcpser"
>
> The result was: 0

May be it "forked" into something else?

> Tcpser was also not started by CRON after a few minutes ...

Do other jobs start in this cron table? Might be a typo or wrong
permission in it?

> Then I typed: ./startSerial
>
> Tcpser started. At the moment it is running, but I don't know why it
> is not startet by CRON automatically, because the script seems to work
> good...?

Doesn't tcpser listen on a port? If it was still running (under a
different name, why ever that may have happened) the port already in use.

May be next time it seems to have stopped also test if the port it runs
on is still used. Something like

lsof -i :1234 (< replace by actual port)
--
Andreas
You know you are a redneck if
you own a homemade fur coat.

6502en...@gmail.com

unread,
Jul 6, 2017, 4:29:48 AM7/6/17
to
"I will make an image of my pi's sd and you can just write that to your flash card and just get it done. I am teaching this evenning so I might not be able to get to it until tomorrow if that's OK. It will be located in the shared folder and publically avalaible"

That would be great! Thanks a lot! (Where is the shared folder?)

"Do other jobs start in this cron table? Might be a typo or wrong
permission in it?"

So far as I see there are no other jobs in that cron table.
I will compare Dropnine's with mine or write that to my card.

Dropnine

unread,
Jul 9, 2017, 10:19:29 PM7/9/17
to
Sorry for the wait, building a garage and teaching is taking quite a slice of my time.

I've included an image for the Pi that will start it on boot and monitor tcpser; in case of a crash it will restart the tcpser application.

You can retrieve the image and documentation here:

https://drive.google.com/drive/folders/0B7Y4Lsah28nCem54WnBWYkZ5LTQ

I've tested the image and it works fine. I took it from my B+ 2011 Pi.

Cheers,
c

6502en...@gmail.com

unread,
Jul 10, 2017, 6:38:02 AM7/10/17
to
Thanks a lot! I'll try that.

Dropnine

unread,
Jul 15, 2017, 12:10:14 AM7/15/17
to
On Monday, 10 July 2017 04:38:02 UTC-6, 6502en...@gmail.com wrote:
> Thanks a lot! I'll try that.

A new image is available. It contains commands to set the serial and a possible wifi connection, as well. setSerial will define the tcp to serial bridge and restart tcpser with the new values. setWifi will setup a WPA encrypted connection if you happen to have a wifi or a USB Wifi on your Pi. If the commands are issued without parameters, they will display a how to use.

It's still not completely fool proof, but it will help those who do not want to edit or possibly messing up their image.

Cheers,
c
0 new messages