[Tutor] First script

Robert L Hicks bobhicks@adelphia.net
Tue, 16 Jan 2001 13:46:39 -0500


#!/usr/local/bin/python

####
#
# Module: inetdconf.py
#
# Created: R.L. Hicks, 2001-01-16
#
# Function: This is a small script to cause the inetd daemon
# to re-read itself after a change to its conf file.
#
# Usage: Run the script as "python inetdconf.py" and answer "YES"
# or "NO" when asked the question about restarting.
##

r = "kill -HUP `ps cax|grep inetd|awk '{print $1}'`"  # restarts the daemon
n = "Inetd not restarted"
w = "Answer needs to be 'yes' or 'no'. Try again!"

answer = " "
 
query = raw_input("Do you want to restart the INETD daemon? (yes/no): ")

answer = query

if len(answer) > 2:
    print r
elif len(answer) < 2:
    print w
else:
    print n


How would you change it and why? Comments welcome...this is my first one
after all.

Bob