Go Back   DaemonForums > Miscellaneous > Guides

Guides All Guides and HOWTO's.

Thread Tools Display Modes
  #1   (View Single Post)  
Old 18th May 2021
J65nko J65nko is offline
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,134
Default Automating the "vi /etc/httpd.conf", httpd -n, rcctl restart httpd" treadmill

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:



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
In action:
/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
Press <CNTRL-C to stop, any other key to re-edit /etc/httpd.conf : ^C
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
Attached Files
File Type: sh ehttpd.sh (212 Bytes, 56 views)
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump

Last edited by J65nko; 21st May 2021 at 05:19 AM.
Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to remove ".php" from urls in httpd? billy_bazooka OpenBSD Packages and Ports 3 23rd January 2021 10:08 AM
Difference between"arp info overwritten" and " duplicate IP address " varag OpenBSD Security 1 6th April 2015 02:57 PM
Where should I put my config? "rc.conf" or "rc.conf.local"? fender0107401 OpenBSD General 2 2nd April 2012 02:53 AM
Fixed "xinit" after _7 _8, "how" here in case anyones' "X" breaks... using "nvidia" jb_daefo Guides 0 5th October 2009 09:31 PM
can't start apache "httpd not running" disappearedng FreeBSD General 5 22nd September 2008 10:18 PM

All times are GMT. The time now is 04:59 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick