Re: editing httpd.conf file through shell script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/18/08, Mohit Anchlia <mohitanchlia@xxxxxxxxx> wrote:>> You can use head and tail commands in shell to do what you want to do. You could do something like:>> x=`grep -n "DocumentRoot /websites/vodafone/web" httpd.conf` # gets the line number> cat httpd.conf|head -$x > tmp.conf> echo "AddType application/x-httpd-php .php" >> tmp.conf> cat httpd.conf|tail +$x >> tmp.conf> mv tmp.conf httpd.conf>> Above code is not tested. It's just for your understanding.
I was able to solve  my able query using sed command .. my script goessome thing like that and its completely solve my problem
sed -i "/MIME_TYPE_$domain2631/a\AddType application x-httpd-php .php\nAddType application x-httpd-php-source .phps"/usr/local/apache2/conf/extra/httpd_vhost.conf
the a ---> stand for append after the given pattern
the \n ---> stand for add ""this"" to next line
But one thing still remain is how do i remove or reverse this procedure ... ??

-- 
सादरAgnello Dsouzawww.linux-vashi.blogspot.com

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux