On 2024-02-14 03:40, -pj via openSUSE Users wrote:
On 02-13-2024 04:49PM, Carlos E. R. wrote:
On 2024-02-13 23:34, -pj via openSUSE Users wrote:
On 02-13-2024 05:59AM, Carlos E. R. wrote:
On 2024-02-13 00:13, -pj via openSUSE Users wrote:
...
One comment. Better place your script in /usr/local/sbin/, that's the standard place for scripts done by the administrator of the machine. /usr/sbin is used by the distribution, and when upgrading/migrating the machine it is easier to just backup and copy the entire /usr/local/ structure.
I moved the file. That's good to know. locate PS2-Keyboard.sh /usr/local/sbin/PS2-Keyboard.sh
I think it's important to 'updatedb' when/if moving these files and changing their names is that correct? I made an error initially by the naming approach of "HP-PS2-Keyboard" then decided PS2-Keyboard would be a better approach in this situation.
Not important. That file is only used in your searches, not by tools in the system. I see
...
------------------------------------------------------------------------ Thinkcentre-M57p:/usr/sbin> cat HP-PS2-Keyboard.sh #!/bin/bash echo KBC0 >/proc/acpi/wakeup echo "the script works" >> /tmp/HP-PS2-Keyboard.txt
Trick:
logger -t Mine -p local1.info "The script works."
(local "one")
When you speak of "(local "one")" I do not understand what you are referring to very well. Can you please explain this a bit more perhaps?
That the "1" in the name is a one, not a lower case "L". There are local1, local2,...local7. I don't remember if more. I can give you tomorrow the rest of the names (I have to find them). See the man page. I apologize for not seeing the clarity which you presented in "(local "one")" initially. I for some reason was thinking something else was
On 02-13-2024 09:57PM, Carlos E. R. wrote: possibly meant by this.
Ah, found them:
The syslog (2) on this machine here contains the similar if not same to displayed below. I was completely oblivious to the connection of syslog and journalctl output before. I see now there is a sort of connection at least.
#CER docs, from syslog(2)
#define KERN_EMERG "<0>" /* system is unusable */
Is this what you are refering to by "local1" (below)?
#define KERN_ALERT "<1>" /* action must be taken immediately */
#define KERN_CRIT "<2>" /* critical conditions */ #define KERN_ERR "<3>" /* error conditions */ #define KERN_WARNING "<4>" /* warning conditions */ #define KERN_NOTICE "<5>" /* normal but significant condition */ #define KERN_INFO "<6>" /* informational */ #define KERN_DEBUG "<7>" /* debug-level messages */
#CER: facility syslog(3) and /usr/include/sys/syslog.h #define LOG_KERN (0<<3) /* kernel messages */ kernel messages (these can't be generated from user processes) #define LOG_USER (1<<3) /* random user-level messages */ (default) #define LOG_MAIL (2<<3) /* mail system */ mail subsystem #define LOG_DAEMON (3<<3) /* system daemons */ system daemons without separate facility value #define LOG_AUTH (4<<3) /* security/authorization messages */ security/authorization messages #define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */ messages generated internally by syslogd(8) #define LOG_LPR (6<<3) /* line printer subsystem */ line printer subsystem #define LOG_NEWS (7<<3) /* network news subsystem */ USENET news subsystem #define LOG_UUCP (8<<3) /* UUCP subsystem */ UUCP subsystem #define LOG_CRON (9<<3) /* clock daemon */ clock daemon (cron and at) #define LOG_AUTHPRIV (10<<3) /* security/authorization messages (private) */ security/authorization messages (private) #define LOG_FTP (11<<3) /* ftp daemon */ ftp daemon
#/* other codes through 15 reserved for system use */ reserved for local use #define LOG_LOCAL0 (16<<3) /* reserved for local use */ #define LOG_LOCAL1 (17<<3) /* reserved for local use */ #define LOG_LOCAL2 (18<<3) /* reserved for local use */ #define LOG_LOCAL3 (19<<3) /* reserved for local use */ #define LOG_LOCAL4 (20<<3) /* reserved for local use */ #define LOG_LOCAL5 (21<<3) /* reserved for local use */ #define LOG_LOCAL6 (22<<3) /* reserved for local use */ #define LOG_LOCAL7 (23<<3) /* reserved for local use */
#define LOG_NFACILITIES 24 /* current number of facilities */ #define LOG_FACMASK 0x03f8 /* mask to extract facility part */ /* facility of pri */ #define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3)
Or
logger -t Mine -p local1.info "Disabling wakeup in PS2 keyboard"
Does this below look like the correct way to implement what you suggest in your second 'trick example' directly above? I probably don't need the "echo "the script works" >> /tmp/PS2-Keyboard.txt", it is informative though. - #!/bin/bash echo KBC0 >/proc/acpi/wakeup echo "Disabling wakeup in PS2 keyboard" >> /tmp/PS2-Keyboard.txt logger -t Mine -p local1.info "Disabling wakeup in PS2 keyboard" -
Certainly. Maybe "-t HP-PS2-Keyboard.sh", though. Up to you. :-) Yes, I made a somewhat dumb error (please see below for update). :[
It's nice to have this so functional now. Many Thanks
Welcome :-)
Ok, I really do not want to push my luck here with the great help you have provided so far but I really do want to ask a few more questions about this situation here with the keyboard. PS2-Keyboard.sh is changed to as follows: - Thinkcentre-M57p:/usr/local/sbin> cat PS2-Keyboard.sh #!/bin/bash echo KBC0 >/proc/acpi/wakeup echo "Disabling wakeup in PS2 keyboard" >> /tmp/PS2-Keyboard.txt echo logger -t PS2-Keyboard.sh -p local1.info "Disabling wakeup in PS2 keyboard" - Is, "echo logger -t PS2-Keyboard.sh -p local1.info "Disabling wakeup in PS2 keyboard" what i'm actually after here (for kernel alerts)?
and you will see that line printed in "journalctl" output.
I have powercycled the machine. Then complete two suspend/unsuspend cycles. Then in Konsole pass: journalctl | grep -i "PS2\|Keyboard" Scrolling down to today's date. Shows what seems to me as somewhat sporatic results for: PS2-Keyboard.sh (meaning each time a suspend/unsuspend cycle completes), does not add a fresh log entry, (viewable in Konsole) even after journalctl | grep -i "PS2\|Keyboard" is passed yet again (after unsuspend completes). See sporatic displayed entry below. Feb 13 22:27:18 Thinkcentre-M57p PS2-Keyboard.sh[1820]: Disabling wakeup in PS2 keyboard Why is a fresh entry of the above "PS2-Keyboard.sh[1820]: Disabling wakeup in PS2 Keyboard" not created every suspend/unsuspend cycle completion? ------------------------------------------------------------------------- Finally, there are many errors displayed (from one source) by journalctl output, about 'executable permissions' as follows: Thinkcentre-M57p systemd[1]: Configuration file /etc/systemd/system/PS2-Keyboard.service is marked executable. Please remove executable permission bits. Proceeding anyway. -rwxr-xr-x 1 root root 331 Feb 13 17:38 PS2-Keyboard.service My mind starts thinking to pass the following: chmod ugo-x PS2-Keyboard.service All the other directories *and* entries in /etc/systemd/system have 'ugo+x' permissions set. What's going on here with that? -------------------------------------------------------------------------- Is this thinking of mine correct about "PS2-Keyboard.service"? Can you suggest a journalctl command that could be more ideal in monitoring the keyboard messages, getting things set up? Thanks again for your insight.