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. ...
------------------------------------------------------------------------ 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. Ah, found them: #CER docs, from syslog(2) #define KERN_EMERG "<0>" /* system is unusable */ #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. :-)
It's nice to have this so functional now. Many Thanks
Welcome :-)
and you will see that line printed in "journalctl" output.
-- Cheers / Saludos, Carlos E. R. (from 15.5 x86_64 at Telcontar)