/etc/logrotate.d/ntp.new , New method seems a bit skewd too me .
by babydr from LinuxQuestions.org on (#6N2Z9)
The logic operator in the new logrotate seems very odd to me .
the "!"(Not) operator is outside all logic interpretation levels thus makeing the logic of the line upto "||" as NOT if it is executable , even if it isn't due to the "||" . Sounds like Double negative to my way of thining .
Can someone run me thru the logic of this ?
Tia , JimL
Code:
# diff -u /etc/logrotate.d/ntp /etc/logrotate.d/ntp.new
--- /etc/logrotate.d/ntp 2021-02-13 03:18:21.000000000 -0900
+++ /etc/logrotate.d/ntp.new 2024-05-25 09:21:16.000000000 -0800
@@ -3,6 +3,6 @@
missingok
rotate 4
postrotate
- [ -x /etc/rc.d/rc.ntpd ] && /etc/rc.d/rc.ntpd restart
+ ! [ -x /etc/rc.d/rc.ntpd ] || /etc/rc.d/rc.ntpd restart
endscript
}
the "!"(Not) operator is outside all logic interpretation levels thus makeing the logic of the line upto "||" as NOT if it is executable , even if it isn't due to the "||" . Sounds like Double negative to my way of thining .
Can someone run me thru the logic of this ?
Tia , JimL
Code:
# diff -u /etc/logrotate.d/ntp /etc/logrotate.d/ntp.new
--- /etc/logrotate.d/ntp 2021-02-13 03:18:21.000000000 -0900
+++ /etc/logrotate.d/ntp.new 2024-05-25 09:21:16.000000000 -0800
@@ -3,6 +3,6 @@
missingok
rotate 4
postrotate
- [ -x /etc/rc.d/rc.ntpd ] && /etc/rc.d/rc.ntpd restart
+ ! [ -x /etc/rc.d/rc.ntpd ] || /etc/rc.d/rc.ntpd restart
endscript
}