[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[MiNT] scripting
I was experimenting with a script to turn inet services on and off.
It's a a lot more complex than stuff I've done before. It seems to
work when using a copy of ited.conf in /home but doesn't work when
I change FILE to point to /etc/inetd.conf
It's run by supplying a services name and on or off
eg
./switch.sh ftp on
#!/bin/bash -x
#
echo switch.sh
FILE="inetd.conf"
#
grep $1 $FILE
#
if [ "$2" = "on" ];then
echo Turn $1 on
REPL="s/^#"$1"/"$1"/g"
else
echo Turn $1 off
REPL="s/"^$1"/#"$1"/g"
fi
#
find . -name $FILE -type f -exec perl -pi -e $REPL {} \;
#
grep $1 $FILE
I cobbled it together from various internet suggestions, there
may be a better way to do this.
Peter