[Solved]Blynk Server not restarting after Raspberry Pi Restart

Hello,

I’m having trouble with getting the local server to start after restarting my Raspberry Pi. I’m wondering if I haven’t modified the rc.local file correctly. Any help would be appreciated. My file is as follows:

#! /bin/sh
### BEGIN INIT INFO
# Provides:          rc.local
# Required-Start:    $all
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:
# Short-Description: Run /etc/rc.local if it exist
### END INIT INFO


PATH=/sbin:/usr/sbin:/bin:/usr/bin

. /lib/init/vars.sh
. /lib/lsb/init-functions

do_start() {
	if [ -x /etc/rc.local ]; then
	        [ "$VERBOSE" != no ] && log_begin_msg "Running local boot scripts (/etc/rc.local)"
		/etc/rc.local
		ES=$?
		[ "$VERBOSE" != no ] && log_end_msg $ES
		return $ES
	fi
}

case "$1" in
    start)
	do_start
        ;;
    restart|reload|force-reload)
        echo "Error: argument '$1' not supported" >&2
        exit 3
        ;;
    stop|status)
        # No-op
        exit 0
        ;;
    *)
        echo "Usage: $0 start|stop" >&2
        exit 3
        ;;
esac

java -jar /home/pi/server-0.11.2.jar -dataFolder /home/pi/Blynk &

Yes, can be frustrating as far as I have found! Mind you I’m not a Linux user …
I ended up using Bitvise and ssh into the pi.
Your rc.local file is exactly as mine…
I copied over the server file and in the end had it in /home and /home/pi and in /home/pi/Blynk! Obviously doesn’t need them all, but I really can’t be salted to worry about a few meg.
Initial attempts just kicked the server out with bj errors.
My /home contains logs and pi dirs. logs are old. Can’t find new logs.
Pi contains Blynk which contains /data… holds user data.
Runs fine now, so I can get on with my projects!

I have never had much luck using the rc.local fine to start applications. I usually use cron tasks.

Try the following…

crontab -e

– add the following line

@reboot java -jar /home/pi/server-0.11.2.jar -dataFolder /home/pi/Blynk &

– save and exit

I am not sure about Java, but with python I have to create a bash script that launches the Python script and put the bash script as the cron task instead of the Python script directly. I bit of a messy work around, but it works…

2 Likes

Crontab worked perfectly. Thanks!

For others having this issues, make sure your server files are located where you are setting your directory. For example, I have all of my files located at /home/pi/Blynk/. My crontab file is as follows:

@reboot java -jar /home/pi/Blynk/server-0.11.3.jar -dataFolder /home/pi/Blynk &

+1 for crontab it’s easy to work with not have to worry about rc.local for a basic Linux user