Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Assistance with scripts for UNIX Post 302275838 by brughm on Monday 12th of January 2009 09:52:21 AM
Old 01-12-2009
Assistance with scripts for UNIX

Hello-
I am new to UNIX (about 1 month to be exact) and have been trying to construct a script to create users and passwords using expect. I have the basic script worked out, which includes creating the user and password, but would like for this to be automated a little more and have it read a list of users from a separate file along with the passwords and then create them based on that separate list.

Here is what I have worked out so far:

# cat testusercreate.sh
#!/usr/bin/expect
# Script for automating creation of user names

spawn ssh approd
expect "root@approd's password:"
send "password2\r"
expect "#"
send "mkgroup test\r"
expect "#"
send "useradd -g test alpha\r"
expect "#"
send "passwd alpha\r"
expect "alpha's New password:"
send "test1\r"
expect "Enter the password again:"
send "test1\r"
expect "#"
send "exit\r"
expect closed
exit 0

Any help would be greatly appreciated

Thanks,
Marty
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

UNIX Scripts

I need to find a place or places on the Internet where I can find UNIX scripts to view and to modify to make life easy on the UNIX environment. Shell scripts to be used, ksh, sh, csh. Can someone help me on this. Thanks ;) (2 Replies)
Discussion started by: wolf
2 Replies

2. UNIX for Advanced & Expert Users

vi scripts on UNIX

Hi there I'm hoping one of the expert unix guys or gals can assist me in understanding the language within scripts e.g clear while true do tput cup 0 0 LIST=`grep cisco /etc/hosts|grep -v _int | awk '{print $2}'` for SITE in $LIST do IP=`grep "$SITE"... (4 Replies)
Discussion started by: nemex
4 Replies

3. UNIX for Dummies Questions & Answers

unix scripts

Hi all Can sombody tell me how can i run a script as a regular user and then change in the middle of the script to root,perform a task that needs root permisions and get back to the regular user. (4 Replies)
Discussion started by: yelalouf
4 Replies

4. UNIX for Advanced & Expert Users

Porting of Windows written unix scripts to unix platform

Can anybody help me in finding out a solution for the problem below? When we write .unix or .sh files in windows OS and port them to Unix platforms there is a character ^M inserted at the end of each line of the script file. During ftp porting I set the transfer mode as ASCII for the script... (7 Replies)
Discussion started by: tamilselvi
7 Replies

5. Windows & DOS: Issues & Discussions

Urgent Need for Assistance: Triggering Windows bat files from UNIX

Hello, Is there a way to trigger a Windows bat file or program on a different machine from a different UNIX server using KSC file? I hope you can assist me with this. Thanks! (0 Replies)
Discussion started by: punyenye
0 Replies

6. UNIX for Advanced & Expert Users

Unix Scripts

Hi, I have to write 2 unix scripts: 1. Check whether the databases are up or down which are on different servers. 2. Check the file system space on different Unix servers. Please share your model scripts here. I have to submit this ASAP. Appreciate your reply...... Thanks (1 Reply)
Discussion started by: dreams5617
1 Replies

7. Shell Programming and Scripting

Unix Scripts

Hi, I have to write 2 unix scripts: 1. Check whether the databases are up or down which are on different servers. 2. Check the file system space on different Unix servers. Please share your model scripts here. I have to submit this ASAP. Appreciate your reply...... Thanks (4 Replies)
Discussion started by: dreams5617
4 Replies

8. Shell Programming and Scripting

Unix scripts

hi everyone.Can anyone tell what books to study for unix shell scripting.ive planned to learn unix scripting but i dont kno what kind of books to refer so do help me..Thanks in advance. (1 Reply)
Discussion started by: madanmeer
1 Replies

9. Shell Programming and Scripting

Assistance understanding a UNIX script

Hello, If I could get some assistance breaking down this Unix script in order to better understand it. A co-worker wrote this script and is no longer with us. I believe this script converts documents into .txt files, but we are trying to edit it so that it converts documents to .pdf automatically... (1 Reply)
Discussion started by: B00GS
1 Replies
uudemon(4)						     Kernel Interfaces Manual							uudemon(4)

NAME
uudemon.admin, uudemon.cleanu, uudemon.hour, uudemon.poll - Administrative shell scripts for polling remote systems, cleaning up spool directories, reporting status to the system administrator, and routine invocations of the uuxqt and uusched daemons SYNOPSIS
These shell scripts reside in the following directory: /usr/lib/uucp DESCRIPTION
All the scripts can be run from the command line or can be run automatically by the cron daemon. To automatically run the scripts, remove the comment character (#) from the beginning of the relevant line in the /var/spool/cron/crontabs/uucp file. This script reports status to the system administrator. It issues the uustat command to find out the status of uucp jobs. It mails the results to the uucp login ID. The script may be modified to send mail to any login ID such as the uucp administrative login ID (uucpa) or root. This script cleans up the /var/spool/uucp and /var/spool/uucppublic directories by running the uucleanup command. The uucleanup com- mand is run with the following parameters: -C7, -D7, X2, -o2, -W1. This script runs the uusched and uuxqt daemons in the background. This script polls the systems listed in the /usr/lib/uucp/Poll file. The uudemon.poll script should be scheduled before the uudemon.hour script. This allows uudemon.poll to create any command files before cron runs the uudemon.hour script. FILES
Contains the uudemon.admin, uudemon.cleanu, uudemon.hour and uudemon.poll files. Contains the uucp file. RELATED INFORMATION
Commands: cron(8), uucleanup(8), uusched(8), uuxqt(1) Files: /usr/lib/uucp delim off uudemon(4)
All times are GMT -4. The time now is 08:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy