fbpx

Record server uptime in text file

Record server uptime in text file

Create a shell script and execute that shell script.

TODAY=$(date +"%T")
SCRIPT=$(uptime | awk '{print $(NF-2)" "$(NF-1)" "$(NF-0)}')
echo "$TODAY | $SCRIPT" >> /root/script/out.txt

 

Share this post