How to automate ECM connection on boot?

Hey everyone,

Does anyone have a “best practice” ie: using systemd/99-rules.com 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 minicom.sh < escape.txt

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

[Unit]
Description=Start Minicom and run AT#ECM=1,0
#Requires=/dev/ttyUSB2
#After=/dev/ttyUSB2
#StartLimitIntervalSec=0

[Service]
Type=simple
Restart=on-failure
RestartSec=1
User=****
Group=****
ExecStart=/usr/bin/env php /home/pi/minicom.sh

[Install]
#WantedBy=multi-user.target

*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?

Thanks.