I need i little help here
When the script runs and creates a backup on my router i need it generate the name as the Router ID + the date + the time.
How do i go about this
{ local id [sys identity get name] local date [sys clock get date ] local time [sys clock get time] sys backup save name="$id;$date;$time" }
:log info "Starting Backup" :local id [/system identity get name] :local time [/system clock get time] :local date [/system clock get date] :local file "$id$date$time" /export compact file=$file :log info "Pausing for 20s" :delay 20s :log info "Sending Backup File via Email" /tool e-mail send file=$file to="email@domain.co.za" subject=([/system identity get name] . \ " Backup") from=email@domain.co.za :log info "Backup Complete" :log info "Pausing for 1m" :delay 1m file remove $file :log info "Cleanup complete" :log info ([/system identity get name] . \ " Backup Completed")
{
:local id [/system identity get name]
:local time [/system clock get time]
:local date [/system clock get date]
:local file "$id_$date_$time"
:local name
:for i from=0 to=([:len $file] - 1) do={
:local char [:pick $file $i]
:if ($char = "/") do={
:set $char "-"
}
:set name ($name . $char)
}
/export compact file=$name
}
{
:local id [/system identity get name]
:local time [/system clock get time]
:local date [/system clock get date]
# rex start
:local arrMonths {jan="01";feb="02";mar="03";apr="04";may="05";jun="06";jul="07";aug="08";sep="09";oct="10";nov="11";dec="12"}
:local today [/system clock get date]
:local date "$[:pick $date 7 11]-$($arrMonths->[:pick $date 0 3])-$[:pick $date 4 6]"
# rex end
:local file "$id_$date_$time"
:local name
:for i from=0 to=([:len $file] - 1) do={
:local char [:pick $file $i]
:if ($char = "/") do={
:set $char "-"
}
:set name "$name$char"
}
/export compact file=$name
}