MogiePete / zabbix-systemd-service-monitoring

Simple Zabbix Template to discover, monitor, and alert on systemd services.
GNU General Public License v2.0
91 stars 41 forks source link

Make usage of date independent of locale #12

Closed ateuber closed 5 years ago

MogiePete commented 5 years ago

@ateuber

What problem is this solving? Can you provide an example of when the locale can result in issues in calculating the restart time?

ateuber commented 5 years ago

This should make it more clear:

andreas@eris ~ $ LC_TIME=en_US.UTF8 date | awk '{print$4}' | tr -d :| sed 's/^0*//'
2019
andreas@eris ~ $ LC_TIME=en_US.UTF8 date +%H%M%S
115808
andreas@eris ~ $ LC_TIME=en_GB.UTF8 date | awk '{print$4}' | tr -d :| sed 's/^0*//'
115808
andreas@eris ~ $ LC_TIME=en_GB.UTF8 date +%H%M%S
115808

Notice the different order:

andreas@eris ~ $ LC_TIME=en_US.UTF8 date
Tue 14 May 2019 11:57:00 AM CEST
andreas@eris ~ $ LC_TIME=en_GB.UTF8 date
Tue 14 May 11:56:53 CEST 2019
MogiePete commented 5 years ago

@ateuber

I have merged PR #13 and now there are code conflicts. Can you please fork the current master branch and then submit your PR agian?

ateuber commented 5 years ago

@MogiePete

I updated my branch and now there are no conflicts any more.

MogiePete commented 5 years ago

@ateuber

Thank you for the contribution!