Startup sh for weatherstation

I have weatherstation connected to RPi2. When I manually run pywws on terminal, it works. Now I`m trying to run script automatically on start. I modified script from creator and put it in /etc/init.d as 80-weather.sh. Script looks like this:

#!/bin/sh

export PATH=$PATH:/usr/local/bin

# exit if NTP hasn't set computer clock
[ `ntpdc -c sysinfo | awk '/stratum:/ {print $2}'` -ge 10 ] && exit

pidfile=/var/tmp/pywws.pid
datadir=/home/osmc/weather/data
logfile=$datadir/live_logger.log

# exit if process is running
[ -f $pidfile ] && kill -0 `cat $pidfile` && exit

# email last few lines of the logfile to see why it died
#if [ -f $logfile ]; then
#  log=/tmp/log-weather
#  tail -40 $logfile >$log
#  /home/osmc/weather/email-log.sh $log "weather log"
#  rm $log
#  fi

# restart process
md /tmp/weather
pywws-livelog-daemon -v -p $pidfile $datadir $logfile start

But script doesnt start on startup (as Im aware of). What am I doing wrong?

Osmc is using systemd.
You should make a script (unit) for that.

There are several threads about this on the forum:

1 Like

Great, thanks for link