How to automate ECM connection on boot?

Hey everyone,

Does anyone have a “best practice” ie: using systemd/ to send an AT command using minicom as a service (atcom can’t seem to communitcate with the serial port for some reason)?

I have a small script with:

send AT#ECM=1,0
expect “OK”

As well as an escape.txt file for quitting minicom.

So my actual script i’d like to make a service is:

sudo minicom -b 115200 -D /dev/ttyUSB2 -S < escape.txt

And this is the service I’m attempting to create:

Description=Start Minicom and run AT#ECM=1,0

ExecStart=/usr/bin/env php /home/pi/


*the hashes are just there because i’m still trying to figure this out.

So my question is, how to i tell my system to wait for ttyUSB2 to be available before the script runs?