beginner's unluck

websrvr websrvr at macftphttp.serverbox.org
Fri Jun 24 15:35:10 EDT 2005


On Jun 24, 2005, at 09:51 AM, Gordon Thagard wrote:

>
>
> websrvr wrote:
>
>
>>
>> On Jun 23, 2005, at 04:47 PM, Gordon Thagard wrote:
>>
>>
>>> Timo Schoeler wrote:
>>>
>>>
>>>
>>>> thus Gordon Thagard spake:
>>>>
>>>>
>>>>
>>>>> Solaris 9
>>>>> Postfix 2.2.2
>>>>> Cyrus-SASL 2.1.20
>>>>> Cyrus-IMAP 2.2.12
>>>>>
>>>>>
>>>>> Hi, I have Cyrus-IMAP running on a box but I'm getting some   
>>>>> errors. Can
>>>>> someone please tell me which direction to go with these symptoms?
>>>>>
>>>>> Jun 23 14:07:16 horus master[29531]: [ID 392559 local6.debug]   
>>>>> about to
>>>>> exec /opt/cyrus-imap/bin/ctl_cyrusdb
>>>>> Jun 23 14:07:16 horus ctl_cyrusdb[29531]: [ID 702911  
>>>>> local6.notice]
>>>>> checkpointing cyrus databases
>>>>> Jun 23 14:07:16 horus ctl_cyrusdb[29531]: [ID 854764 local6.error]
>>>>> DBERROR: error listing log files: Permission denied
>>>>> Jun 23 14:07:16 horus ctl_cyrusdb[29531]: [ID 686478 local6.error]
>>>>> DBERROR: archive /var/imap/db: cyrusdb error
>>>>> Jun 23 14:07:16 horus ctl_cyrusdb[29531]: [ID 578205 local6.debug]
>>>>> archiving database file: /var/imap/annotations.db
>>>>> Jun 23 14:07:16 horus ctl_cyrusdb[29531]: [ID 854764 local6.error]
>>>>> DBERROR: error listing log files: Permission denied
>>>>> Jun 23 14:07:16 horus ctl_cyrusdb[29531]: [ID 686478 local6.error]
>>>>> DBERROR: archive /var/imap/db: cyrusdb error
>>>>> Jun 23 14:07:16 horus ctl_cyrusdb[29531]: [ID 578205 local6.debug]
>>>>> archiving database file: /var/imap/mailboxes.db
>>>>> Jun 23 14:07:16 horus ctl_cyrusdb[29531]: [ID 127214   
>>>>> local6.notice] done
>>>>> checkpointing cyrus databases
>>>>> Jun 23 14:07:16 horus master[17383]: [ID 310780 local6.debug]   
>>>>> process
>>>>> 29531 exited, status 0
>>>>>
>>>>> The master process is running as user 'cyrus' and ownership of
>>>>> /var/imap/* is set to 'cyrus:mail'. Also, I'm using pwcheck as  
>>>>> it  was
>>>>> the only way I could get Postfix to authenticate correctly. Sadly,
>>>>> Cyrus-IMAP doesn't like this and is giving me unknown user  
>>>>> errors. I
>>>>> want it to authenticate via NIS.
>>>>>
>>>>> Any and all assistance is greatly appreciated.
>>>>>
>>>>> Cheers,
>>>>>
>>>>> Gordon Thagard
>>>>>
>>>>
>>>>
>>
>> This may help...
>>
>>
>> #!/bin/sh
>> #
>> # /usr/sbin/reconstruct_imap_db
>> #
>>
>> # Configuration Variables
>> the_imap=/var/imap
>> the_user="cyrus"
>> the_group="mail"
>> recon_path=/usr/bin/cyrus/bin/reconstruct
>>
>> case $TERM in
>>     #   for the most important terminal types we directly know  
>> the  sequences
>>     xterm|xterm*|vt220|vt220*)
>>         bold=`awk 'BEGIN { printf("%c%c%c%c", 27, 91, 49, 109); }'  
>> </ dev/null 2>/dev/null`
>>         norm=`awk 'BEGIN { printf("%c%c%c", 27, 91, 109); }' </ 
>> dev/ null 2>/dev/null`
>>         ;;
>>     vt100|vt100*|cygwin)
>>         bold=`awk 'BEGIN { printf("%c%c%c%c%c%c", 27, 91, 49,  
>> 109,  0, 0); }' </dev/null 2>/dev/null`
>>         norm=`awk 'BEGIN { printf("%c%c%c%c%c", 27, 91, 109, 0,   
>> 0); }' </dev/null 2>/dev/null`
>>         ;;
>> esac
>>
>> if [ `whoami` != "root" ]; then
>> cat <<X
>>
>> $0 must be run as ${bold}root${norm} user.
>>
>> X
>> exit
>> fi
>>
>> do_cmd=false;
>>
>> while test $# -gt 0; do
>>     if test "$1" = "--force" -o "$1" = "-f"; then
>>         do_cmd=true
>>     fi
>>     shift
>> done
>> if test "$do_cmd" != true; then
>> cat    <<X
>>
>> use "${bold}$0 --force${norm}" or "${bold}$0 -f${norm}" to  
>> perform  the repair.
>>
>> X
>> else
>> cat <<X
>>
>> ${bold}Reconstructing${norm} the mail database.
>>
>> X
>> echo "Stoping mail"
>> serveradmin stop mail
>> if [ -d /var/imap.old ]; then    rm -rf /var/imap.old; fi
>> echo "Moving database: ${the_imap} -> ${the_imap}.old"
>> mv /var/imap /var/imap.old
>> echo "Making new database: -> ${the_imap}"
>> mkdir /var/imap
>> /usr/bin/cyrus/tools/mkimap
>> echo "Fixing permissions: -> "
>> chown -R ${the_user}:${the_user} /var/imap
>> echo "Reconstructing the database: -> ${the_imap}"
>> sudo -u ${the_user} ${recon_path} -i
>> echo "Starting mail"
>> serveradmin start mail
>> cat <<X
>>
>> If you see no errors it completed succcessfully.
>>
>> X
>> fi
>>
>> ---
>> Cyrus Home Page: http://asg.web.cmu.edu/cyrus
>> Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
>> List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html
>>
>>
>
> Hi, what is this serveradmin? I didn't see it in my source dir or  
> in my bin dir.
>
> ---


It's how I start and stop all the mail services.

All this script does is stop/start services by predefining the  
dependancies.

When I stop mail I stop postfix and imap.


Here is a reduced version so you can see roll your own serveradmin.

#!/bin/sh
#
# /usr/sbin/serveradmin
#

. /etc/rc.common

case $TERM in
     #   for the most important terminal types we directly know the  
sequences
     xterm|xterm*|vt220|vt220*)
         bold=`awk 'BEGIN { printf("%c%c%c%c", 27, 91, 49, 109); }' </ 
dev/null 2>/dev/null`
         norm=`awk 'BEGIN { printf("%c%c%c", 27, 91, 109); }' </dev/ 
null 2>/dev/null`
         ;;
     vt100|vt100*|cygwin)
         bold=`awk 'BEGIN { printf("%c%c%c%c%c%c", 27, 91, 49, 109,  
0, 0); }' </dev/null 2>/dev/null`
         norm=`awk 'BEGIN { printf("%c%c%c%c%c", 27, 91, 109, 0,  
0); }' </dev/null 2>/dev/null`
         ;;
esac

if [ `whoami` != "root" ]; then
cat <<X

$0 must be run as ${bold}root${norm} user.

X
exit
fi

service_command="$1"

case $service_command in
     # Available commands
     start)
         command="start"
         ;;
     stop)
         command="stop"
         ;;
     restart)
         command="restart"
         ;;
     *)
         printf "\"${bold}${service_command}${norm}\" is an invalid  
command.\n"
         exit
         ;;
esac

service_name="$2"

case $service_name in
     # Available services - mail, apache, spamav
     #
     # requires entries in /etc/hostconfig with -YES- or -NO-  
(allowed/not allowed to run)
     #
     # WEBSERVER=-YES-
     # AMAVISCLAMAV=-YES-
     #
     # use apache as a template and add the commands to stop mail  
servicess
     #
     mail)
         # your stuff goes here
         ;;
     apache)
         StartService () {
             if [ "${WEBSERVER:=-NO-}" = "-YES-" ]; then
                 ConsoleMessage "Starting Apache"
                 /usr/sbin/apachectl start
             else
                 StopService
                 NoService
             fi
         }
         StopService () {
                 ConsoleMessage "Stoping Apache"
                 /usr/sbin/apachectl stop
         }
         RestartService () {
             if [ "${WEBSERVER:=-NO-}" = "-YES-" ]; then
                 ConsoleMessage "Reloading Apache"
                 /usr/sbin/apachectl reload
             else
                 StopService
                 NoService
             fi
         }
         NoService () {
             ConsoleMessage "Service is disabled in /etc/hostconfig:  
Unable to start."
         }
         RunService "$service_command"
         ;;

     spamav)
         StartService () {
             if [ "${AMAVISCLAMAV:=-NO-}" = "-YES-" ]; then
                 ConsoleMessage "Starting AMAVIS-CLAMAV"
                 /usr/local/bin/freshclam -d
                 /usr/local/sbin/clamd
                 su clamav -c /usr/local/bin/amavisd
             else
                 NoService
             fi
         }

         StopService () {
             ConsoleMessage "Stoping AMAVIS-CLAMAV"
                 if [ -f /var/clamav/clamd.pid ]; then kill -HUP $ 
(head -1 /var/clamav/clamd.pid); fi
                 if [ -f /var/clamav/freshclam.pid ]; then kill -HUP $ 
(head -1 /var/clamav/freshclam.pid); fi
                 if [ -f /var/amavis/amavisd.pid ]; then kill -HUP $ 
(head -1 /var/amavis/amavisd.pid); fi
         }

         RestartService () {
             if [ "${AMAVISCLAMAV:=-NO-}" = "-YES-" ]; then
                 ConsoleMessage "Reloading AMAVIS-CLAMAV"
                 StopService
                 StartService
             else
             StopService
             NoService
             fi
         }

         NoService () {
             ConsoleMessage "Service is disabled in /etc/hostconfig:  
Unable to start."
         }

     RunService "$service_command"

         ;;
     *)
         printf "\"${bold}${service_name}${norm}\" is an invalid  
service\n"
         exit
         ;;
esac


---
Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html




More information about the Info-cyrus mailing list