EasyManua.ls Logo

UUGear Witty Pi 4 - Page 36

Default Icon
53 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
32
have required path information for frequently used commands. As a result, you will need to use full
path for all commands in beforeScript.sh, afterStartup.sh and beforeShutdown.sh. Below is an
example:
This code snippet waits for network and then query the webpage from UUGear’s website. Please
notice the full path for commands and files.
hostname /usr/bin/hostname
sleep /usr/bin/sleep
wget /usr/bin/wget
wget.log /home/pi/wget.log
If you are not sure about the full path of a command, you can use whereis command to find out.
All commands you put in beforeScript.sh, afterStartup.sh or beforeShutdown.sh will be executed in
sequence. If one of the commands takes rather long time, the commands after it will be postponed
accordingly.
If you don’t want a command to block other commands, you can run it in the background by
appending “&” at the end of that command, like this:
while [ "$(/usr/bin/hostname -I)" = "" ]; do
/usr/bin/sleep 1
done
/usr/bin/wget "https://www.uugear.com/” >/home/pi/wittypi/wget.log 2>&1
pi@raspberrypi:~ $ whereis sleep
sleep: /usr/bin/sleep /usr/share/man/man1/sleep.1.gz /usr/share/man/man3/sleep.3.gz
/usr/bin/wget "https://www.uugear.com/” >/home/pi/wittypi/wget.log 2>&1 &

Table of Contents