Execute external bash script on server with blynk))

both))))
I just want running by default on boot blynk-client… which can execute external script)))

You have both now.

Pleace))))) can you provide some
forver-service utilities usage)))

forever-service just google it.

That one?

That’s the one.

But i managed to start it via rc.local and detached screen with 5 seconds sleep, as u can see in rc.local log
Its only did not launch external script…
just to make it launch /home/zara/try.sh

Please explain this in full as I have no idea what a detached screen is.

screen is a linux utility to emulate different virtual desktops, but then with terminals. E.g. you can start a program on screen 1 when you are at home and you can take over that terminal at work :slight_smile:

If the external script is not running it can be 1 of several problems:

  1. The js file is not calling the bash script
  2. The bash script has errors
  3. You have a problem with the path
  4. You have a problem with file permissions

/bin/su root -c “/usr/bin/screen -dmS blynk /bin/bash /home/zara/blynk.sh”
rc.local detached screen smple
1,2,4 are not
Cause if i launch client manualy it works and lauch script!
I was asking about those lines with child_process. Do they need full path?

That is possibly because your local server hasn’t started before the client tries to run from rc.local.

Move the client to the forever-service.

You should assume everything needs the full path.

NOPE! Local server is on remote pc, its not same with client
And i see online status hw in app!

Ok post the following:

  1. Bash script that calls the client from rc.local
  2. Your js Blynk client file
  3. The bash script

Sure but a hour later, im in subway returning home. Ok?

Don’t rule out 4 just because it works when you manually start the Blynk client.
Looks like you are possibly root when you are doing it manually and might not be when using rc.local
Take a look at the file permissions for your bash script and maybe

sudo chmod +x bash_file.sh

Its already chmoded to hell! With +x and 777

f…ing formating

my 1.js - blynk client file, i dont warry about token shown… it will be deleted

blynk.sh ’ is to show that # exist)))

'#!/bin/bash
sleep 5
/usr/bin/env node /home/zara/1.js

zhopa.sh))))))))))))))))))

'#!/bin/sh
wakeonlan -i 192.168.32.51 -p 7 C8:60:00:15:74:AB
echo 1111 >> zhopa.sh

Damd! i think i find error myself))))))

Where?

Are you saying the error is:

echo 1111 >> zhopa.sh

and it should be something like

echo 1111 >> test.txt

i foget “!” in blynk.sh before #
Yip that was it!
i corret this error while pasting text here
Now it works great as detachet screen

zara@carpi:~$ sudo screen -ls
There is a screen on:
640.blynk (06.03.2017 17:49:11) (Detached)

It was nessesary to show full path to echo to write something to file…
test.sh wrote script to /root instead of my home directory and i thought it was not work)))))))))))))))))))))))

But it WOLs PC good NOW!!!

1 Like