Dons Deals

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Saturday, 15 June 2013

CentOS - TUI's text-based user interfaces, available from the official CentOS repository for system administration using text-based user interfaces

Posted on 18:36 by Unknown
Here's a great Article on using text-based user interfaces (TUI), which are often in the form of wizards, and which provide options for navigation, accept text input, and show progress bars in CentOS...

Don 

CentOS system administration using text-based user interfaces

Posted by Anatoliy Dimitrov on Thu, Jun 13, 2013

Administering CentOS 6 from the command line is not always intuitive and easy, especially when it comes to complex commands with hard-to-remember arguments and strict syntax. Many CentOS servers lack an X Window System graphical interface, which supports applications that could ease administration tasks. They can, however, run text-based user interfaces (TUI), which are often in the form of wizards, and which provide options for navigation, accept text input, and show progress bars.

CentOS has plenty of TUIs available from the official CentOS repository. For instance, system-config-network-tui helps you configure the CentOS network. This powerful Python script saves you the burden of editing numerous files to modify your network interfaces, routes, and DNS information. Similarly, system-config-firewall-tui helps you configure your firewall. It offers basic options to just allow incoming services, such as DNS and FTP, and more advanced options to fine-tune the iptables rules, such as configuring trusted interfaces and masquerading.

To find more TUIs, run yum search tui, or look for executables whose names end with -tui by using the argument whatprovides with a regular expression: yum whatprovides *bin/*-tui. This command turns up, among others, the package authconfig and its executable /usr/bin/authconfig-tui, which guides you through CentOS's authentication configuration. It allows you to configure advanced settings such as the use of LDAP authentication servers and caching of passwords. Without a TUI, authentication configuration is one of the most unpleasant administration tasks in CentOS because of the need to edit numerous files and perform various checks.

You may also find a TUI by just searching for system-config, though some of the results will require graphical interfaces. For example, system-config-users, a tool for managing users and groups, does require an X interface, while system-config-keyboard, a tool for configuring the keyboard and its layouts, is a pure command-line TUI.

Unfortunately, there is no reliable way to tell whether a system-config script requires an X interface or runs at the command line. You can try figuring it out by reading the description of the package with the command yum info PACKAGENAME. You may also be able to tell whether X is required by the dependencies of a package. Run yum deplist PACKAGENAME to see if a package has any X-related dependencies. For example, the package system-config-date requires the package gnome-python2-canvas, part of the GNOME X desktop, so clearly it requires an X interface.

Other system TUI scripts are not related to any specific keyword. One example is the script /usr/sbin/ntsysv, part of the ntsysv package, which helps you configure the runlevels for all installed services, including whether the services should be started and stopped with the system. It's a big help for those who are not familiar with the /sbin/chkconfig command, which manages the startup scripts and runlevels.

With such an abundance of TUIs, how do you remember them all and associate them with the tasks they are for? Turn to the package setuptool and the command it provides, /usr/sbin/setup, to detect all installed system-related TUIs and show them in a well-organized menu.

Besides the native CentOS TUIs, you can find many TUIs that come from third-party software providers for their respective applications. These TUIs not only make things easier but in some cases are the only feasible way to perform an installation and configuration. For example, the 389 Directory Server comes with a few TUIs, and you should use its main configuration script, /usr/sbin/setup-ds-admin.pl, for the initial configuration.

While TUI scripts look attractive in comparison to the daunting tasks of running complex commands, TUIs are limited and cannot be complete replacements for all configuration tasks. For example, ntsysv does not allow you to manage a service for a program that you have installed manually. For that purpose you still need to use the command line, as described in the article How to write CentOS initialization scripts with Upstart. For more advanced tasks and uncommon scenarios you will still need to run commands with numerous arguments and edit text configuration files.

Create your own TUI

By now you should be convinced of the benefits of TUIs, and you may wish to create your own. In CentOS, most TUIs implementations are based on the Curses library. For Bash, the most popular Curses implementation is called Dialog. Dialog integrates seamlessly with Bash scripts and provides good-looking TUIs through simple code. Install it with the command yum install dialog.

Dialog provides various TUI components, such as progress bars, menus, and text boxes. Here is an example Dialog script with a menu text box:

#!/bin/bash    #The dialog part. By default, the chosen menu item goes to STDERR (2). From there it's redirected to a temp file (/tmp/temp_file) in the script.  /usr/bin/dialog --title "Delete /tmp content" --menu "Delete /tmp content older than:" 10 30 0 1 "1 day" 2 "2 days" 2> /tmp/temp_file    #Get the choice by reading the /tmp/temp_file  option=`cat /tmp/temp_file`    #Remove the temp file  rm -f /tmp/temp_file    #Clear the screen for better readibility  /usr/bin/clear    #Create a function to delete the temp content. It accepts as an argument a number of days. Any content older than this number will be deleted.  function delete_tmp {      /bin/echo "Deleting files and directories older than $1 day(s) in /tmp"      /bin/find /tmp/ -type f -mtime +$1 -exec rm {} -rf \;      #Show a dialog gauge with the progress       /bin/echo "50" | /usr/bin/dialog --gauge "Deleting files" 10 30 0      #For better visual effect wait 1 second before continuing      /bin/sleep 1      /bin/find /tmp/ -type d -mtime +$1 -exec rm {} -rf \;      #Show a dialog gauge with the progress again      /bin/echo "100" | /usr/bin/dialog --gauge "Deleting directories" 10 30 50      /bin/sleep 1      #Clear the screen      /usr/bin/clear  }    #Go through a conditional statement  #First check if $option is not null. Option is null usually when the cancel button from the menu is pressed.  if [ -z $option ]; then      /bin/echo 'Cancel pressed. Exiting.'  #Check if the first option is chosen  elif [ $option -eq 1 ]; then      delete_tmp 1  #Check the second option  elif [ $option -eq 2 ]; then      delete_tmp 2  fi  

This TUI script first gives you a menu with two options – to delete content older than one or two days in the /tmp directory. Once you make your choice, the script displays a gauge with the progress. See how after both the menu and the gauge parameters there are two numbers – 10 30? These specify the height and width of the text box measured in text characters. The third number after the two basic dimensions is the height of the menu. In the case of the gauge this third number denotes where the progress bar should start from in terms of percent.

As you can see, the CentOS shell is not just about dull commands with long arguments. With TUIs, the shell becomes interactive and easier to use.




This work is licensed under a Creative Commons Attribution 3.0 Unported License
.
Tags: CentOS, Technical, Tutorial


Go there...
http://www.openlogic.com/wazi/bid/297159/centos-system-administration-using-text-based-user-interfaces

Wazi Open Source Software Technical Articles

  • Home
  • Search
  • Source Code Scanning Solutions
  • Products and Support
  • Services
  • Enterprise OSS Blog
  • Wazi Technical Blog
  • About Wazi
  • Attributions and Licensing
  • Supply Chain Compliance
  • How to Contribute
  • Contributors
  • Resources Library
  • Cloud Services
  • Partners
  • Customers
  • Community
  • Company
  • Careers
  • News and Events
  • Contact Us



Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • ZigBee - a specification for a suite of high level communication protocols used to create personal area networks built from small low-power digital radios
    ZigBee From Wikipedia, the free encyclopedia Jump to: navigation , search ZigBee ...
  • Open Sorce Hardware - The Wandboard is a low cost board based on the i.MX6 multicore ARM Cortex-A9 family of processors. In consists of a core module based on the EDM standard and a simple to extend baseboard
    Here's an Open Source Wandboard - Freescale i.MX6 ARM Cortex-A9 Opensource Community Development Board. The Wandboard is a low ...
  • 1967 Chevy Camaro Complete Rebuild - Videos, HowStuffWorks Videos "NAPA Videos"
    Video Playlist - West Coast Customs Shop, Completely Tears Down a 1967 Chevy Camaro and then does a Complete Rebuild...
  • Installing and Updating GRUB 2 in Fedora Linux
    This Page has allot of info on Installing, Updating and Trouble Shooting Grub 2 in Fedora Linux. There are some good How To's for...
  • Dynaco Stereo 400 Power Amplifier - Dead Channel Fix - Dynaco Repairs For PC-28 Amplifier Boards
    My Dynaco Stereo 400 Amp... The Page Below these e-mails with Kevin Boales. Looks like the one that I found. Back in ...
  • Open source PLC's - PLC (programmable logic controller)
    Here's some Great Looking Open source PLC Projects. The OSPLC Small & Large Bricks are open-source PLC (programmable logic ...
  • NetProMax PC with Motherboard P5PE-VM ASUSTeK
    Here are some links to info on the NetProMax PC with Motherboard P5PE-VM ASUSTeK ... Don ASUSTe...
  • Running a PXE Boot Server in Parted Magic
    Here's some good info on Running PXE Boot Server in Parted Magic... Don PXE – Parted Magic PXE PXE: the "classic" way ...
  • Americas Health Care - Obama Care - Key Features of the Affordable Care Act - Health Care and Education Reconciliation Act
    Finally! Some real info, as in... This is the date that the Affordable Care Act, goes into effect. Open enrollment in the Heal...
  • Building a Brushless Motor Controller using an ATmega Chip - by Davide Gironi
    Here's a very in depth Article on Building a Brushless Motor Controller using an ATmega Chip - by Davide Gironi... Do...

Blog Archive

  • ▼  2013 (354)
    • ►  December (12)
    • ►  November (33)
    • ►  October (23)
    • ►  September (46)
    • ►  August (52)
    • ►  July (36)
    • ▼  June (45)
      • Murph - a Man Exploring the World on a BMW R 1150
      • Crazy Robotic Drummer - YouTube Video and Many Mor...
      • How to Make Pull-Out Shelves for Kitchen Cabinets ...
      • iGoogle Alternatives - The deadline for the demise...
      • Dynasphere a monowheel vehicle design patented in ...
      • Would you trust a Company in India with your Medic...
      • Hitch Hikers Ride to the Moon - Moon Mission for $300
      • MacBook Conversions and Repairs adding Internal US...
      • A New Linux Distro - SolydX and SolydK are Debian ...
      • Fedora 19 Final RC2 Desktop Download - FedoraProject
      • Can Air Pollution Be Good for the Earth? - Discove...
      • Facebook Bug worse than reported - Non-users also ...
      • Electronic Cello - Theremin Cello and the New Ther...
      • A New Old Electronic Musical Instrument - The Onde...
      • MonotrOndes - Korg Monotron hacked into Ondes Mart...
      • George of the Jungle - YouTube
      • The Jungle - Book
      • Rethinking Bottled Water - by Gina Shaw WebMD.com
      • Adjustable Power Supplies DC Voltage Regulators DC...
      • How to use a Multimeter for beginners - Part 1 - V...
      • Making Graphene with a DVD burner and Synthesizing...
      • Fly Geyser is located on the private Fly Ranch and...
      • Icons - Collections of Free Icons and Software to ...
      • WiSee - Wi-Fi signals enable gesture recognition t...
      • Cybersecurity for Medical Devices and Hospital Net...
      • 3 Ways to Control Black Spot on Roses - wikiHow
      • Ophcrack - My Review for ophcrack at SourceForge.n...
      • Google begins launching Internet-beaming balloons ...
      • CentOS - TUI's text-based user interfaces, availab...
      • ServiWin: Windows Services/Drivers Tool (start/sto...
      • DIY Cyclone Dust Collectors and Wet Spill Vacuum C...
      • Here's your Kitten Video, for Today
      • Fedora Linux Project - Download Links and info
      • Recalls, Market Withdrawals, & Safety Alerts > Ald...
      • Open source PLC's - PLC (programmable logic contro...
      • How are these Car Thieves exploiting Automotive Ke...
      • XnView - Great Free Software for reading, organizi...
      • Glary Utilities by Glarysoft - One Click Windows P...
      • UDOO - Android Linux Arduino in a tiny single-boar...
      • Ninite.com Easy Multiple Open Source App Installer...
      • Screenshot Captor - Free Software at DonationCoder...
      • Billionaires Dumping Stocks, Economist Knows Why -...
      • Autoranging Multimeter Review - YouTube
      • Linux Terminal Basics and some Commands - Codecademy
      • Pidora The Raspberry Pi Fedora Remix - opensource.com
    • ►  May (17)
    • ►  April (38)
    • ►  March (19)
    • ►  February (22)
    • ►  January (11)
  • ►  2012 (145)
    • ►  December (27)
    • ►  November (31)
    • ►  October (14)
    • ►  September (15)
    • ►  August (48)
    • ►  July (10)
Powered by Blogger.

About Me

Unknown
View my complete profile