cdsteinkuehler / beaglebone-universal-io

Device tree overlay and support scripts for using most available hardware I/O on the BeagleBone without editing dts files or rebuilding the kernel
GNU General Public License v2.0
127 stars 54 forks source link

can the systemd messages be disabled? #56

Open bigguiness opened 6 years ago

bigguiness commented 6 years ago

I have a systemd service that uses config-pin to load the cape-universal overlay and then uses a file with config-pin to configure the pins. When it starts I get a bunch of noise in the systemd journal like:

Apr 06 10:11:21 beaglebone sudo[547]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/bash -c echo cape-universal > /sys/devices/bone_capemgr.*/slots Apr 06 10:11:21 beaglebone sudo[547]: pam_unix(sudo:session): session opened for user root by (uid=0) Apr 06 10:11:22 beaglebone sudo[547]: pam_unix(sudo:session): session closed for user root Apr 06 10:11:23 beaglebone sudo[789]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/bash -c echo low > /sys/class/gpio/gpio66/direction Apr 06 10:11:23 beaglebone sudo[789]: pam_unix(sudo:session): session opened for user root by (uid=0) Apr 06 10:11:23 beaglebone sudo[789]: pam_unix(sudo:session): session closed for user root Apr 06 10:11:23 beaglebone sudo[803]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/bash -c echo gpio > /sys/devices/ocp.3/P8_07_pinmux.14/state Apr 06 10:11:23 beaglebone sudo[803]: pam_unix(sudo:session): session opened for user root by (uid=0) Apr 06 10:11:23 beaglebone sudo[803]: pam_unix(sudo:session): session closed for user root

There are similar messages for each direction/state setting.

Is there anyway to suppress these messages? They add a lot of noise to the journal.

Thanks

bigguiness commented 6 years ago

I figured out a solution to avoid the noise in the journal.

The following patch first checks the id or the user. If it's root, the "sudo -A" is removed from the various "bash -c "echo ..." commands. If the if is non-root, the "sudo -A" is used.

Regards


--- config-pin.orig 2018-05-08 09:05:19.399629072 -0700 +++ config-pin 2018-05-08 09:11:12.341035364 -0700 @@ -1,5 +1,11 @@

!/bin/dash

+if ! id | grep -q root; then

bigguiness commented 6 years ago

Well... that did't post well... Not sure how this Markdown stuff works...

bigguiness commented 6 years ago

Maybe this will work...

`--- config-pin.orig 2018-05-08 09:05:19.399629072 -0700 +++ config-pin 2018-05-08 09:11:12.341035364 -0700 @@ -1,5 +1,11 @@

!/bin/dash

+if ! id | grep -q root; then

bigguiness commented 6 years ago

Nope... If you need the patch please let me know and I will email it to you.