Community discussions

MikroTik App
 
bardossyAdrian
just joined
Topic Author
Posts: 10
Joined: Mon Jan 08, 2018 2:33 pm

Problem with export terse

Wed Apr 25, 2018 3:50 pm

Hi guys,

I have written script for automated backup of mikrotik every day, last time I have added to command /export file="filename" also terse and verbose and it is throwing syntax error. I am sending you code in bash and specific code, which makes mess. On terminal in ROS this command work perfectly.

I also tried some debugging, with keyword verbose export is working but with keyword terse not. Can you help me please? Code is below.

ssh $user@$address ':local name [/system identity get name];:local date [/system clock get date];:local day [ :pick $date 4 6 ];:local month [ :pick $date 0 3 ];:local backupName ($name."_".$month.$day."export");:put $backupName;/export file=$backupName  verbose terse'
Best regards,
Adrian Bardossy
 
skullzaflare
just joined
Posts: 22
Joined: Tue Apr 12, 2016 12:01 am

Re: Problem with export terse

Thu May 03, 2018 8:33 pm

May or may not help. This is the local part of the script on ours
# Set Filename variables. Do not change this unless you want to edit the format of the filename.

:local date ([:pick [/system clock get date] 0 3]  \
. [:pick [/system clock get date] 4 6] \
. [:pick [/system clock get date] 7 11]);
:local filename "$hostname_$date";

# Create backup file and export the config.

export compact file="$filename"
/system backup save name="$filename"

:log info "Backup Created Successfully"
Scheduled to run every day at midnight. There is more to it since ours also sends it to a FTP server, but this is the part that creates it locally
That exact line would name the file (if router name is cosmo) "cosmo_may032018.rsc" and backup for today

Who is online

Users browsing this forum: No registered users and 23 guests