Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 

ios kron system variables

Does the IOS kron feature have system variables we can use in commands it issues?

I am looking to schedule a command (ephone-hunt statistics write-all url/filename) but am needing to customize the filename and was hoping i could use a variable to use the current date/time as part of the filename so it is unique.

Any ideas? Would EEM be able to do this?

6 REPLIES
Cisco Employee

Re: ios kron system variables

EEM would be more suited to doing this. You can write an EEM timer policy using a cron timer, and customize the input using EEM environment variables. For example:

event manager environment hunt_stats_filename flash:/file_1.txt

See http://www.cisco.com/en/US/products/ps6441/products_configuration_guide_chapter09186a00807c676c.html for more in EEM.

Re: ios kron system variables

Ok, I looked over that doc again (found it earlier) and there doesn't seem to be a time and/or date variable.

What I am basically looking for is to make the URL unique each time the command runs. So the filename (part of URL) is different.

So, for example, the router command would be like. I am using copy running-config to keep it simple for everyone.

copy running-config tftp://1.2.3.4/%date%-config.txt

where %date% would be expanded to be a real date so the end result is

copy running-config tftp://1.2.3.4/08172007-config.txt

or something similar. Then run it runs again the filename would be 08182007-config.txt and then 08192007-config.txt and so on.

Cisco Employee

Re: ios kron system variables

Here's an EEM TCL policy I wrote a while ago that does pretty much what you just described. Instead of TFTP, though, it uses FTP. It is a timer policy that requires a few environment variables to be set:

cc_cron_entry : Cron entry specifying when to run the policy

cc_ftp_server : Hostname or IP address of the FTP server

cc_ftp_path : Destination path on the FTP server

cc_ftp_user : (optional) Username for the FTP server

cc_ftp_pass : (optional) FTP user password

You should be able to modify this policy for your needs.

Re: ios kron system variables

Thanks for sharing. I'll play with this and post back my TCL once I get what I need working. Are there any other tcl files I need to load on the flash (doesn't look like it, but this is my first time using EEM).

Do you mind sharing the eem config lines?

Cisco Employee

Re: ios kron system variables

This script requires no other supporting libraries. To register it, make a directory on flash called policies, then set the required environment variables based on the values you require. Then:

event manager directory user policy "flash:/policies"

event manager policy config_copy_policy.tcl type user

After that, it will run based on the cc_cron_entry environment variable value.

Community Member

Re: ios kron system variables

Hello Guys!

I'm new with Cisco and EEM. I'm check your policy script, but I don't know how to edit it.

Can you explain me, I have to edit the archieve directly our I need do another thing in my equipment.

2424
Views
5
Helpful
6
Replies
CreatePlease to create content