You can add simple commands to EdgeOS. For example, reset is a top-level EdgeOS command that is not available in the CLI.
For this example, we'll add a command to reset the console.
- When first running the reset command, a single option exists.
[email protected]:~$ reset ? openvpn
- To add commands, it's necessary to become the root user. The sudo command is used to gain root user privileges.
[email protected]:~$ sudo bash [email protected]:/home/ubnt#
- Now as root user, navigate to the directory with all of the operational mode templates.
[email protected]:/home/ubnt# cd /opt/vyatta/share/vyatta-op/templates [email protected]:/opt/vyatta/share/vyatta-op/templates# ls add delete ping6 reset terminal clear disconnect reboot restart traceroute configure generate release set traceroute6 connect initial-setup remove show undebug copy no rename shutdown update debug ping renew telnet
- Go to the reset directory and create a reset sub-command.
- Use the mkdir command to create a directory called console.
et# mkdir console [email protected]:/opt/vyatta/share/vyatta-op/templates/res et# cd console
- While in root, use the cat (concatenate) command to create a file named node.def in the console directory. Add the lines "help..." and "run..." as listed below. Hit enter then press ctrl + c to finish editing the file.
et/console# cat > node.def help: Reset the console run: /usr/bin/reset
- Exit out of root and try out the new command:
et/console# exit exit [email protected]:~$ reset ? console openvpn [email protected]:~$ reset ? Possible completions: console Reset the console openvpn Reset OpenVPN
[email protected]:~$ reset console