Runs commands or scripts supported by the Linux OS directly from the SLX-OS CLI.
Privileged EXEC mode
This command is only available for users with admin-level permissions.
All scripts run under oscmd must have execute permission.
After writing and testing a user-defined script file, you can copy it to the SLX-OS device. Imported scripts are stored in the /var/config/vcs/scripts directory.
You can also create scripts from the Linux shell using the "vi" editor. The newly-created scripts must exist in the /fabos/users/admin directory.
In the following example, the Linux ps -ef command lists the process status from the CLI.
device# oscmd ps -ef UID PID PPID C STIME TTY TIME CMD root 1 0 0 Jul24 ? 00:00:04 /sbin/init root 2 0 0 Jul24 ? 00:00:00 [kthreadd] root 3 2 0 Jul24 ? 00:00:00 [migration/0] root 4 2 0 Jul24 ? 00:00:03 [ksoftirqd/0] root 5 2 0 Jul24 ? 00:00:00 [migration/1] root 6 2 0 Jul24 ? 00:00:03 [ksoftirqd/1] root 7 2 0 Jul24 ? 00:00:00 [migration/2] root 8 2 0 Jul24 ? 00:00:02 [ksoftirqd/2] root 9 2 0 Jul24 ? 00:00:00 [migration/3] root 10 2 0 Jul24 ? 00:00:02 [ksoftirqd/3] root 11 2 0 Jul24 ? 00:00:00 [migration/4] root 12 2 0 Jul24 ? 00:00:02 [ksoftirqd/4] root 13 2 0 Jul24 ? 00:00:00 [migration/5] root 14 2 0 Jul24 ? 00:00:03 [ksoftirqd/5] root 27 2 0 Jul24 ? 00:00:00 [cpuset] root 28 2 0 Jul24 ? 00:00:01 [khelper] root 31 2 0 Jul24 ? 00:00:00 [netns] root 34 2 0 Jul24 ? 00:00:00 [async/mgr] root 270 2 0 Jul24 ? 00:00:00 [sync_supers] root 272 2 0 Jul24 ? 00:00:00 [bdi-default] ... root 8kblockd/6]182 1 0 Jul24 ? 00:00:00 /usr/sbin/inetd root 8237 1 0 Jul24 ? 00:00:00 /usr/sbin/sshd admin 27536 27535 0 04:19 pts/4 00:00:00 ps -ef
In the following example, "my_script" is the name of a user-defined script that is downloaded by using the copy command or exists in the /fabos/users/admin directory; and is executable under the Linux OS .
device# oscmd my_script