Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Some of my apache configs are failing like this (because of a bug in control panel, but I need a workaround till this gonna be fixed):

/etc/init.d/httpd start
Starting httpd: Syntax error on line 30 of /home/apache/conf/domains/mydomain.conf:
RUidGid takes two arguments, Minimal uid or gid file/dir, else set[ug]id to default (User,Group)
                                                           [FAILED]

I would like to write a script that will automatically remove such configs, but when I type /etc/init.d/httpd start >> error.log nothing is written to file. The same happens when I try to grep a line from /etc/init.d/httpd start | grep Syntax.

share|improve this question

1 Answer 1

Try

/etc/init.d/httpd start 2>&1 >>error.log

It redirects also STDERR to STDOUT.

share|improve this answer
    
No, it still writes only [FAILED] to log file –  Spacedust Mar 13 '12 at 12:34
1  
Got it ! It should be: /etc/init.d/httpd start 2> error.log –  Spacedust Mar 13 '12 at 12:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.