Line 7: |
Line 7: |
| ==Crontab syntax and editing overview== | | ==Crontab syntax and editing overview== |
| | | |
− | This section of the guide overviews the syntax of crontab rules and editing environment choices. | + | This section of the guide overviews the syntax of crontab rules, editing methods and editing environment choices. |
| | | |
| ===Editing environment=== | | ===Editing environment=== |
| ---- | | ---- |
− | Firstly, you must decide on what environment you want to use for editing. Crontabs can be edited via a '''Command Line Interface''' ('''CLI'''). RUT routers offer a range of options in that regard. For example, you can use the CLI present in the router's WebUI ('''Services → CLI'''). Or you can log in via '''SSH''' and make edits from there. The method of logging in via SSH is different on different systems: on Linux systems you can use the '''Terminal''' app log in with the command '''''ssh root@<routers_lan_ip_address>'''''; on '''Windows''' systems you can use the free '''PuTTY''' client. | + | Firstly, you must decide on what environment you're going to use for editing. Crontabs can be edited via a '''command line interface''' ('''CLI'''). RUTxxx routers offer a range of options in that regard. For example, you can use the CLI present in the router's WebUI ('''Services → CLI'''). Or you can login via '''SSH''' and make edits from there. The method of logging in via SSH is different on different systems: on Linux systems you can use the '''Terminal''' app login with the command '''''ssh root@<routers_lan_ip_address>'''''; on '''Windows''' systems you can use the free '''PuTTY''' client. |
| | | |
− | In all cases the log in information is the same (user name: '''root'''; password: admin password (default: '''admin01''')). The syntax of the commands is also the same, so feel free to follow the guide step-by-step whichever method you choose. | + | In all cases the login information is the same (user name: '''root'''; password: admin password (default: '''admin01''')). The syntax of the commands is also the same, so feel free to follow the guide step-by-step whichever method you choose. You can find more detailed information on RUTxxx command line interfaces in our other wiki article '''[[Command line interfaces]]'''. |
| | | |
− | Once you've chosen your preferred environment, we can begin the overview on the syntax and editing of crontabs. | + | Once you've chosen your preferred environment, we can begin the overview of the syntax and editing of crontabs. |
| | | |
| ===Syntax and editing=== | | ===Syntax and editing=== |
| ---- | | ---- |
− | Crontab entries are stored in the '''/etc/crontabs/root''' file. You can edit that file directly with the command '''''vi /etc/crontabs/root''''', but it is more convenient to edit with '''''crontab -e''''', which we'll be using for all examples in this guide. ''-e'' is an option used with the ''crontab'' command for editing. Presented below is a list all options that can be used with ''crontab'': | + | Crontab entries are stored in the '''/etc/crontabs/root''' file. You can edit that file directly with the command '''''vi /etc/crontabs/root''''', but it is more convenient to edit with '''''crontab -e''''', which we'll be using for all examples in this guide. ''-e'' is an option of the ''crontab'' command; used for editing. Presented below is a list of all options that can be used with ''crontab'': |
| | | |
| Usage: crontab [-c DIR] [-u USER] [-ler]|[FILE] | | Usage: crontab [-c DIR] [-u USER] [-ler]|[FILE] |
Line 30: |
Line 30: |
| FILE Replace crontab by FILE ('-': stdin) | | FILE Replace crontab by FILE ('-': stdin) |
| | | |
− | As an example, lets try the '''''-l''''' option that shows the contents of the crontab file: | + | As a demonstration, lets try the '''''-l''''' option that shows the contents of the crontab file: |
| | | |
| [[File:Configuration example 1 crontabs.png]] | | [[File:Configuration example 1 crontabs.png]] |
| | | |
− | For the sake of example, I've added a Ping Reboot rule to the router's configuration. In the figure above you can see that creating such a rule also generates an entry (encapsulated in green) in the crontab list. Let's examine this entry: | + | For the sake of this example, I've added a Ping Reboot rule to the router's configuration beforehand. In the figure above you can see that creating such a rule via the router's WebUI also generates an entry (encapsulated in green) in the crontab rule list. Let's examine this entry: |
| | | |
| * '''/sbin/ping_reboot 1 8.8.8.8 NULL 2 56 5 1 0 cfg02c21d''' - indicates the action that is to be taken. In this case it is the ''/sbin/ping_reboot'' command with the options ''1 8.8.8.8 NULL 2 56 5 1 0 cfg02c21d'' | | * '''/sbin/ping_reboot 1 8.8.8.8 NULL 2 56 5 1 0 cfg02c21d''' - indicates the action that is to be taken. In this case it is the ''/sbin/ping_reboot'' command with the options ''1 8.8.8.8 NULL 2 56 5 1 0 cfg02c21d'' |