Using Expect to Automate System Administration Tasks
Don E. Libes
UNIX systems administration often involves programs designed only for interactive use. Many such programs (passwd, su, etc.) cannot be placed into shell scripts. Some programs (fsck, dump, etc) are not specifically interactive, but have poor support for automated use. Expect is a program which can talk to interactive programs. A script is used to guide the dialogue. Scripts are written in a high-level language and provide flexibility for arbitrarily complex dialogues. By writing an expect script, can run interactive programs non- interactively. Shell script are incapable of managing these systems administration tasks, but expect scripts can control them and many others. Tasks requiring a person dedicated to interactively responding to badly written programs, can be automated. In a large environment, the time and aggravation saved is immense. Expect is similar in style to the shell, and can easily be mastered by any systems administrator who can program in the shell already. This paper presents real examples of using expect to automate system administration tasks such as passwd and fsck. Also discussed are a number of other systems administration tasks that can be automated.
Proceedings of the Fourth USENIX Large Installation Systems Administration (LISA)
Using Expect to Automate System Administration Tasks, Proceedings of the Fourth USENIX Large Installation Systems Administration (LISA), [online], https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=821312
(Accessed February 25, 2024)