0

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" 
0

From man date:

%s     seconds since 1970-01-01 00:00:00 UTC

So 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" 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.