Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Spacecmd ====== **General Information** Spacewalk provides centralized management of Red Hat systems. * Official Site: https://fedorahosted.org/spacewalk/) * Local Wiki Page: [[linux_wiki:spacewalk]] Spacecmd is the command line interface to the server and is much faster than logging into the web portal. **Checklist** * Distro(s): Enterprise Linux * Other: [[https://fedorahosted.org/spacewalk/wiki/HowToInstall|Spacewalk server]] setup * Other: Spacewalk user account created ---- ===== Install Spacecmd ===== * Add spacewalk client repo * CentOS 6<code bash>rpm -Uvh http://yum.spacewalkproject.org/2.4-client/RHEL/6/x86_64/spacewalk-client-repo-2.4-3.el6.noarch.rpm</code> * CentOS 7<code bash>rpm -Uvh http://yum.spacewalkproject.org/2.4-client/RHEL/7/x86_64/spacewalk-client-repo-2.4-3.el7.noarch.rpm</code> * Install spacecmd * <code bash>yum install spacecmd</code> ---- ===== Spacecmd Config File ===== Setting up the spacecmd config file greatly shortens the command, as you do not have to specify server, username, and password each time. Create the file ~/.spacecmd/config <code bash> mkdir ~/.spacecmd chmod 700 ~/.spacecmd touch ~/.spacecmd/config chmod 600 ~/.spacecmd/config </code> Edit the file <code bash> vim ~/.spacecmd/config [spacecmd] server=spacewalkserver.mydomain.com username=usernamehere password=passwordhere </code> Verify configuration by testing connectivity <code bash> spacecmd </code> ---- ===== Useful Alias ===== It is also useful to create the following alias in your ~/.bashrc file <code bash> alias spacecmd='spacecmd -q' </code> This will always execute spacecmd with the quiet option. This will not show logging into the server info, which just gets in the way if you are trying to pipe output to other commands. ---- ===== Clear Caches ===== Spacecmd creates a local cache of system queries to improve performance. This can leave you with outdated information when working at the CLI in some situations. To clear the local cache <code bash> spacecmd clear_caches </code> ---- ===== Group Commands ===== List system groups <code bash> spacecmd group_list </code> List systems in a group <code bash> spacecmd group_listsystems <GROUP> </code> Add systems to a group (SYSTEMS space separated) <code bash> spacecmd group_addsystems <GROUP> <SYSTEMS> </code> Remove systems from a group (SYSTEMS space separated) <code bash> spacecmd group_removesystems <GROUP> <SYSTEMS> </code> ===== System Commands ===== List all systems (good for piping to grep) <code bash> spacecmd system_list </code> Delete system(s) from Spacewalk (SYSTEMS space separated) <code bash> spacecmd system_delete <SYSTEMS> </code> List a System's Base Channel <code bash> spacecmd system_listbasechannel <SYSTEM> </code> List a System's Child Channels <code bash> spacecmd system_listchildchannels <SYSTEM> </code> Set an entire group's base channel <code bash> spacecmd -y system_setbasechannel group:<GROUP-NAME> <BASE-CHANNEL-NAME> </code> List systems in a group and all errata except kernel: <code bash> spacecmd system_listerrata group:<GROUP-NAME> | grep -vi "kernel" </code> Errata install command: <code bash> spacecmd -y system_applyerrata group:<GROUP-NAME> <ERRATA-NAME> </code> List installed packages, grep for glibc: <code bash> spacecmd system_listinstalledpackages <SYSTEM> | grep glibc </code> ---- ===== Report Commands ===== Systems Not in Any Group <code bash> spacecmd report_ungroupedsystems </code> Systems Not Checking In and Last Checkin Time <code bash> spacecmd report_inactivesystems </code> ---- linux_wiki/spacecmd_spacewalk_cmd_line.txt Last modified: 2019/05/25 23:50(external edit)