Ich möchte dies:Wie finden Sie Benutzer, die in den letzten 24 Stunden mit dem Server verbunden sind?
sojjan pts/9 localhost Thu Oct 13 08:04:14 2016 - Thu Oct 13 08:04:15 2016 (00:00)
gurra pts/9 localhost Wed Oct 12 15:36:00 2016 - Wed Oct 12 15:36:02 2016 (00:00)
sojjan pts/8 :0 Wed Oct 12 10:13:34 2016 still logged in
sojjan pts/7 :0 Mon Oct 10 13:34:56 2016 still logged in
Um so geworden:
Last 24h SSH logins:
sojjan pts/9 localhost Thu Oct 13 08:04:14 2016 - Thu Oct 13 08:04:15 2016 (00:00)
gurra pts/9 localhost Wed Oct 12 15:36:00 2016 - Wed Oct 12 15:36:02 2016 (00:00)
Still logged in:
sojjan pts/8 :0 Wed Oct 12 10:13:34 2016 still logged in
sojjan pts/7 :0 Mon Oct 10 13:34:56 2016 still logged in
Ich versuchte so
#!/bin/bash
test0=$(last -F | grep still)
test1=$(date | awk {'print $2, $3'});
test2=$(date --date='-1 days' | awk {'print $2, $3'});
last -F | grep -v 'reboot' | grep -i "$test0\|$test1\|$test2"
Dank Mustafa und Fedorqui. Ich bin neu so. –
Aber ich weiß nicht, wie ich diese Informationen zu einem funktionierenden Skript bekomme. heee –
@Larsvontrierpung dann musst du selbst forschen. Wir sind nicht hier, um Sie zu füttern, sondern um Ihnen zu helfen. Probieren Sie es aus und kommen Sie mit spezifischen Fragen zurück. – fedorqui