Finally, after fiddling around I am able to resolve the issue.
As per the WiringPi setup guide to set the direction of a gpio u should use
gpio mode 21 out
This method works if you are using #!/bin/sh shell
But if you want to use #!/bin/bash shell then you have to use
gpio -g mode 21 out
After, setting up the direction with use of '-g' I am ...
The real issue was that wget would occasionally wait to read data from the URL. It's default read timeout is 900 seconds, which froze/paused the service making it appear like it crashed. Or it would just return 4 , which means Network Failure and wait indefinitely.
Thanks to @Dmitry Grigoryev I have added a simple --timeout=2 which will tell wget to wait 2 ...
I agree with @DmitryGrigoryev to use libcurl in the C++ program and handle everything there without a shell script because of robustness. But because you still asked in a comment: "So there is no way of debugging that stupid script ?" I will give this answer how I would do it.
I would execute the shell script directly with a service. So you can verify if ...
Check out this post on the difference between sh and bash:
In summary of key points, sh is really a standard and bash was originally an implementation of that standard that evolved to have a lot of extensions, some of which caused it to deviate from the standard.
When you do #!/bin/...
You should analyse the exit code wget is returning: this will allow you to tell if it's a file IO problem, a network problem, etc. You should also use --timeout=seconds to make sure wget won't sit there indefinitely waiting for a connection.
Having two processes is quite normal, as you use system() which executes a command using /bin/sh, and your script ...
I tried to install command-not-found on Raspbian Buster with:
pi@rasberrypi:~ $ sudo apt install command-not-found
It succeeds without error messages. After a reboot I get:
pi@rasberrypi:~ $ zbarcam
Could not find the database of available applications, run update-command-not-found as root to fix this
Sorry, command-not-found has crashed! Please file a ...
(1) I ran "$ sudo apt-get install command-not-found" and got message saying OK, blah, blah, blah, version 18.04.5-1.
(2) "$ sudo update-command-not-found" returns nothing. I guess it means no update to do.
(3) I don't understand the "rpi" component thing. I read that there are 3 packages.
(4) I don't know what is "sources.list",...
I'm guessing you've been misled by tutorials or blogs which imply or explicitly state that .bashrc can be used for things you want to happen at boot.1 This is essentially false, although it has side effects that might make it seem that otherwise.
.bashrc is a shell initialization file. There are a few different flavours of these, which you can read about ...
Undo the modification you have done.
Bashrc is a simple file name and has no special meaning but the bash shell (that what makes the command line) uses a configuration file $HOME/.bashrc. Notice the dot at the beginning of the filename. It makes the configuration file invisible. You can show it with ls -a. Check if you have the .bashrc file.
I am using a Bluetooth num/keypad (not a full keyboard) with all keys mapped specific to my app and with stickers on top of them. And I also started to notice lots of screenshots in my home directory. Then I realised that one of the keys I have mapped in my app is actually a print screen key on this Bluetooth physical keyboard! If you by any chance have an ...