Hi,
I am using Raspberry Pi 3 with Jessie. I want to start a service before network start attempt . I am using a gprs modem and it requires Power Up over Gpio. I have to power up modem before ppp0 attempt for connect.
Gprs powerup script
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(12, GPIO.OUT)
GPIO.setup(13, GPIO.IN)
GPIO.setup(20, GPIO.OUT)
for i in range(0,20):
GPIO.output(20, not GPIO.input(20))
time.sleep(0.1)
if GPIO.input(13) == 1:
print "gprs powerup"
GPIO.output(12, 1)
time.sleep(2)
GPIO.output(12, 0)
time.sleep(4)
else:
print "gprs also powered"
Failed systemd file
[Unit]
Description=StartGprs
After: network-pre.target
[Service]
Type=idle
ExecStart=/usr/bin/python /home/pi/startGprs.py
StandardOutput=null
[Install]
WantedBy=network-pre.target
Alias=StartGprs.service