I need to check my timestamp after "seconds since 1970-01-01 00:00:00 UTC" and print it to this csv file.
What's wrong in this code?
#!bin/bash
echo %computername%, timestamp=$( date +%T ) >> "system_monitor.csv" 1 Answer
From man date:
%s seconds since 1970-01-01 00:00:00 UTCSo you want date +%s, not date +%T.
And if by %computername% you mean the hostname, use the $HOSTNAME variable or the hostname command. So, something like:
#!bin/bash
echo "$HOSTNAME, timestamp=$( date +%s )" >> "system_monitor.csv"