Running a sh file on Synology
I’ve a Synology NAS box running with an ARM71. I installed a Blynk server which is running only when I’m connected via Putty. When I disconnect myself from the NAS server, Blynk stops running. To ensure the Blynk server is running, a watchdog.sh is created to be executed every 5 minutes via cron.
My Blynk files are stored in a blynk folder at volume1/blynk/
When the following watchdog file is executed, a command not found error is generated. Its function is to check if the blynk server is running and if not, execute it.
I’m not keen in Linux so any help is appreciated.
#!/bin/sh # #Watchdog script for blynk server # stat=`/bin/ps -aux | /bin/grep -c "blynk"` server="server-0.29.6.jar" if [ $stat -lt "2" ]; then /usr/local/bin/java -Djava.net.preferIPv4Stack=true -jar /volume1/blynk/$server -serverConfig /volume1/blynk/server.properties -dataFolder /volume1/blynk/ & fi