[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Fab-user] Escaping sudo command for config file search and replace
From: |
Rudiger Wolf |
Subject: |
Re: [Fab-user] Escaping sudo command for config file search and replace |
Date: |
Thu, 02 Dec 2010 07:27:17 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101027 Lightning/1.0b2 Thunderbird/3.1.6 |
On 01/12/10 22:32, Rudiger Wolf wrote:
> Hi
>
> I have a config file with
>
> LogFile="/some/directory/access.log"
>
> Which I want to change to
>
> LogFile="/other/place/access.log"
>
>
This is what I ended up getting working
#update parameter so that awstats knows where to find the log it's
supposed to be analysing
linenumber=sudo('sed -n "/^LogFile=/="/tmp/awstats.model.conf',pty=True)
if len(linenumber)>0:
logfilepath='%(www_path)s/%(wpdomain)s/log' % env
sudo('cat /tmp/awstats.model.conf | sed %sd | sed
\'%si\LogFile=\"%s\"\' > /tmp/awstats.model.conf.tmp'%
(linenumber,linenumber,logfilepath) ,pty=True)
sudo('mv /tmp/awstats.model.conf.tmp
/tmp/awstats.imodel.conf',pty=True)