According to
Larry Wall, one of the virtues of a programmer is lazyness.
I think this also applies to a website administrator. So to avoid repetitive typing while editing, checking
httpd.conf(5) and restarting the webserver I wrote the following simple script:
Code:
#!/bin/sh
DAEMON=httpd
while true ; do
vi "/etc/${DAEMON}.conf"
${DAEMON} -n && rcctl restart ${DAEMON}
printf "Press <CNTRL-C to stop, any other key to re-edit /etc/${DAEMON}.conf : " ; read A
done
In action:
Code:
root@nedrag[~]./ehttpd.sh
/etc/httpd.conf:33: syntax error
/etc/httpd.conf:37: syntax error
Press <CNTRL-C to stop, any other key to re-edit /etc/httpd.conf :
configuration OK
httpd(ok)
httpd(ok)
Press <CNTRL-C to stop, any other key to re-edit /etc/httpd.conf : ^C
root@nedrag[~]
By changing
DAEMON=relayd and renaming to
erelayd.sh you can also use it for
relayd(8)
The script could be extended or generalized to edit other configuration files, but you already guessed it: I am too lazy for that