I have shell Script which is currently running in every 5 minutes (i configured in crontab) and sending all the output in same file.
- I want that in every 5 minute(when cronjob will exexute) the output of the script should be send in new file with "current_date_year_time.csv"
Current Script
#!/bin/sh
ipath=/usr/local/nextone/bin
ifile=/var/tmp/EndpointUsage.csv
"$ipath"/cli iedge list | awk '
BEGIN { print "------------------------------------";
printf "|%-17s|%-16s|\n","Registration ID", "Ongoing Calls"
}
/Registration ID/ { id = $3; next }
/Ongoing Calls/ {print "------------------------------------"; printf "|%-17s|%-16s|\n",id,$3 }
END{
print "------------------------------------";
}'>> "$ifile"
Current output is coming like as below.
EndpointUsage.csv I want something like below. EndpointUsage_09:55-Am_09_05_2015.csv EndpointUsage_10.00-Am_09_05_2015.csv EndpointUsage_10:05-Am_09_05_2015.csv
Can anyone please help me on this. Thank you in advance.
I edited your script to suite your needs, see below:
The additions I made was
Format the timestamp according to your needs.