Cool stuff for Raspberry Pi, Arduino and all electronics hobby projects
Notifications
Clear all

Witty Pi 4 L3V7 Scripts not being run before or after reboot

1 Posts
1 Users
0 Likes
15 Views
(@andrew-simpson17)
Posts: 103
Estimable Member Customer
Topic starter
 

Right,

 

I am trying to log some messages to the syslog file when I stop and stop my Rpi.

 

These are my files:

beforeScript.sh

##!/bin/bash
# file: beforeScript.sh
#
# This script will run after Raspberry Pi boot up, and before running the schedule script.
# If you want to change the schedule script before running it, you may do so here.
#
# Remarks: please use absolute path of the command, or it can not be found (by root user).
# Remarks: you may append '&' at the end of command to avoid blocking the main daemon.sh.
#
sudo /usr/bin/logger '******************************************* beforeScript'

 

beforeShutdown.sh

#!/bin/bash
# file: beforeShutdown.sh
sudo /usr/bin/logger '**************************************** beforeShutdown'

 

afterStartup.sh

#!/bin/bash
# file: afterStartup.sh
#
# This script will run after Raspberry Pi boot up and finish running the schedule script.
# If you want to run your commands after boot, you can place them here.
#
# Remarks: please use absolute path of the command, or it can not be found (by root user).
# Remarks: you may append '&' at the end of command to avoid blocking the main daemon.sh.
#
sudo /usr/bin/logger '******************************************* afterStartup'

 

 

I performed two scenarios:

 

I have opened a terminal. I have rebooted the Rpi.

I press my momentaty swicth then is connected to GPIO4. Terh Rpi shuts down. I press the buttin again.  The Rpi starts up.

 

Now when I look in my syslog file I can see no record of my logging.

 

Please advise?

 

 

 

 

 
Posted : 20/12/2024 2:58 pm
Join Waitlist We will inform you when the product arrives in stock. Please leave your valid email address below.