Albert
September 6, 2019, 6:15pm
1
I want my BeagleBone machine to automatically start a script called server.js. It includes BoneScript (BeagleBone’s unique function) and many functions including reading voltage and ampere from other machines.
I used this tutorial Executing a script on startup using BeagleBone Black
It kept showing status=203/EXEC error.
I tried the same tutorial for simple programs without Bonescript and Functions. Indeed, simple sending and receiving scripts are working without any issue.
How can I remove the error? I think it happens from importing BeagleScript and Functions. I’m not familiar with Linux environment.
Can anyone help to solve the issue?
Thanks,
Detail for Error:
https://stackoverflow.com/questions/57826763/how-to-fix-beaglebone-black-service-file-autostart-script-error-status-203-exec
ExecStart=/var/lib/cloud9/Projects echo ****** | sudo -S bash scriptname.sh
don't do that echo * | sudo stuff... it's already root...
ExecStart=/var/lib/cloud9/Projects/scriptname.sh
Regards,
Albert
September 6, 2019, 7:55pm
3
Hi, Robert. Thanks for quick reply.
Indeed, after changing to ExecStart=/var/lib/cloud9/Projects/scriptname.sh
It still showing error.
Do you or anyone knows how to solve the problem?
● scriptname.service
Loaded: loaded (/etc/systemd/system/scriptname.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2019-09-06 19:52:26 UTC; 15s ago
Main PID: 2595 (code=exited, status=1/FAILURE)
Sep 06 19:52:26 beaglebone scriptname.sh[2595]: at Object.Module._extensions…js (module.js:586:10)
Sep 06 19:52:26 beaglebone scriptname.sh[2595]: at Module.load (module.js:494:32)
Sep 06 19:52:26 beaglebone scriptname.sh[2595]: at tryModuleLoad (module.js:453:12)
Sep 06 19:52:26 beaglebone scriptname.sh[2595]: at Function.Module._load (module.js:445:3)
Sep 06 19:52:26 beaglebone scriptname.sh[2595]: at Module.runMain (module.js:611:10)
Sep 06 19:52:26 beaglebone scriptname.sh[2595]: at run (bootstrap_node.js:394:7)
Sep 06 19:52:26 beaglebone scriptname.sh[2595]: at startup (bootstrap_node.js:160:9)
Sep 06 19:52:26 beaglebone systemd[1]: scriptname.service: Main process exited, code=exited, status=1/FAILURE
Sep 06 19:52:26 beaglebone scriptname.sh[2595]: at startup (bootstrap_node.js:160:9)
Sep 06 19:52:26 beaglebone systemd[1]: scriptname.service: Main process exited, code=exited, status=1/FAILURE
lines 1-13…skipping…
WulfMan
September 6, 2019, 8:00pm
4
Hi, Robert. Thanks for quick reply.
Indeed, after changing to ExecStart=/var/lib/cloud9/Projects/scriptname.sh
ExecStart=/var/lib/cloud9/Projects/server.js <-- maybe ?
Looks like: NODE_PATH=/usr/lib/node_modules is not set..
Regards,
Albert
September 6, 2019, 10:14pm
6
Hi, thanks for reply.
I tried ExecStart=/var/lib/cloud9/Projects/server.js, but still not working.
Albert
September 6, 2019, 10:16pm
7
Hi, RobertCNelson.
Thanks for your answer.
I added this line in service file
Environment=NODE_PATH=/usr/lib/node_modules
[Unit]
After=network-online.target
[Service]
Type=simple
Environment=NODE_PATH=/usr/lib/node_modules
ExecStart=/usr/bin/scriptname.sh
[Install]
WantedBy=multi-user.target
But it shows this error.
● scriptname.service
Loaded: loaded (/etc/systemd/system/scriptname.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2019-09-06 21:00:29 UTC; 8s ago
Main PID: 3613 (code=exited, status=1/FAILURE)
Sep 06 21:00:29 beaglebone scriptname.sh[3613]: at Object.Module._extensions…js (module.js:586:10)
Sep 06 21:00:29 beaglebone scriptname.sh[3613]: at Module.load (module.js:494:32)
Sep 06 21:00:29 beaglebone scriptname.sh[3613]: at tryModuleLoad (module.js:453:12)
Sep 06 21:00:29 beaglebone scriptname.sh[3613]: at Function.Module._load (module.js:445:3)
Sep 06 21:00:29 beaglebone scriptname.sh[3613]: at Module.runMain (module.js:611:10)
Sep 06 21:00:29 beaglebone scriptname.sh[3613]: at run (bootstrap_node.js:394:7)
Sep 06 21:00:29 beaglebone scriptname.sh[3613]: at startup (bootstrap_node.js:160:9)
Sep 06 21:00:29 beaglebone systemd[1]: scriptname.service: Main process exited, code=exited, status=1/FAILURE
Sep 06 21:00:29 beaglebone systemd[1]: scriptname.service: Unit entered failed state.
Sep 06 21:00:29 beaglebone systemd[1]: scriptname.service: Failed with result ‘exit-code’.
Do you know why this error shows up?
Thanks,
add the export inside your script file...
#!/bin/bash
cd /var/lib/cloud9/Projects
node server.js
Regards,
Albert
September 6, 2019, 10:58pm
9
Hi, Robert.
I tried to put these into code one-by-one.
Do you know why it still shows error?
export NODE_PATH=’/usr/lib/node_modules’
export NODE_PATH=/usr/lib/node_modules
export NODE_PATH=/usr/lib/node_modules:$NODE_PATH
Thanks,
Hello,
I just used StackOverflow to answer your question if you have not already figured it out.
Seth
P.S. I can help you on this subject as I have come across this issue many times. So, answer there or here. I will keep looking out.