Results 1 to 8 of 8

Thread: Stop Services Via SSH Hangs...

  1. #1
    mlissner is offline Intermediate Member
    Join Date
    Sep 2007
    Location
    Berkeley, CA
    Posts
    24
    Rep Power
    7

    Default Stop Services Via SSH Hangs...

    EDIT: Title should be Start Services via SSH Hangs! Oops...

    I'm trying to write a backup script from one computer to another that will log into the zimbra server, stop services, log out, back it up, log back in, start services, and then log out again.

    Everything works peachy, except starting the services again. The script that is doing that looks like this:
    Code:
    #!/bin/bash
    
    # This script should simply start the zimbra server.
    
    #Login as root to the zimbra server
    ssh -T root@192.168.1.132  <<NOMORE
    
    #Start the zimbra server
    su - zimbra
    zmcontrol start
    
    #Log out of the zimbra server
    NOMORE
    
    exit 0
    The problem I am having is that it gets most of the job done like so:
    Code:
    ### ZimbraStart.sh 
    Host mail.michaeljaylissner.com
    	Starting ldap...Done.
    	Starting logger...Done.
    	Starting mailbox...Done.
    	Starting antispam...Done.
    	Starting antivirus...Done.
    	Starting snmp...Done.
    	Starting spell...Done.
    	Starting mta...Done.
    But then it just hangs there after that last line. The script doesn't end, and thus the backup is not successful.

    Any thoughts about why it would just hang once it was NEARLY complete?
    Last edited by mlissner; 05-18-2008 at 08:53 PM.

  2. #2
    webman's Avatar
    webman is offline Special Member
    Join Date
    Oct 2007
    Location
    North East England
    Posts
    167
    Rep Power
    7

    Default

    I'm not sure why it's hanging, but to return to the shell immediately after executing you could use this line (just append an ampersand on the end):

    Code:
    zmcontrol start &
    Or alternatively, to check the status once complete (useful in log files):

    Code:
    zmcontrol start; zmcontrol status
    Craig Rodway &#187; Flickr | Last.fm | Del.icio.us | Twitter

  3. #3
    uxbod's Avatar
    uxbod is offline Moderator
    Join Date
    Nov 2006
    Location
    UK
    Posts
    8,017
    Rep Power
    24

    Default

    does the same happen if you do
    Code:
    su - zimbra -c 'zmcontrol start'
    what appears in /var/log/zimbra.log when this happens ?

  4. #4
    phoenix is online now Zimbra Consultant & Moderator
    Join Date
    Sep 2005
    Location
    Vannes, France
    Posts
    23,484
    Rep Power
    56

    Default

    IIRC there are problems with some distributions and using 'su', the following seems to work:

    Code:
    sudo -u zimbra /opt/zimbra/bin/zmcontrol stop
    Regards


    Bill


    Acompli: A new adventure for Co-Founder KevinH.

  5. #5
    mlissner is offline Intermediate Member
    Join Date
    Sep 2007
    Location
    Berkeley, CA
    Posts
    24
    Rep Power
    7

    Default

    @webman - Yeah, I thought about that, but that command is part of the backup script, so if I add & to the end of that line, it will run in the background, and the backup might start prematurely...

    @uxbox - yeah, tried that. No dice...

    @pheonix - I didn't try it with the entire command written out like that, but I did try sudo -u zimbra zmcontrol start....which had the same problem. I will try this tonight and post again, though I'm not optomistic at the moment.

  6. #6
    uxbod's Avatar
    uxbod is offline Moderator
    Join Date
    Nov 2006
    Location
    UK
    Posts
    8,017
    Rep Power
    24

    Default

    Code:
    #!/bin/bash
    
    # This script should simply start the zimbra server.
    
    #Login as root to the zimbra server
    ssh -T root@192.168.1.132  <<NOMORE > /tmp/ssh.log 2>&1
    
    #Start the zimbra server
    su - zimbra
    zmcontrol start
    
    #Log out of the zimbra server
    NOMORE
    
    exit 0
    I added redirection on the script to see if that has any effect.
    Last edited by uxbod; 05-19-2008 at 11:27 PM. Reason: changed working

  7. #7
    mlissner is offline Intermediate Member
    Join Date
    Sep 2007
    Location
    Berkeley, CA
    Posts
    24
    Rep Power
    7

    Default

    Well, I figured out how to fix this. I upgraded to the latest version of Zimbra, and tried the script again. All better.

  8. #8
    mlissner is offline Intermediate Member
    Join Date
    Sep 2007
    Location
    Berkeley, CA
    Posts
    24
    Rep Power
    7

    Default

    Quote Originally Posted by uxbod View Post
    Code:
    #!/bin/bash
    
    # This script should simply start the zimbra server.
    
    #Login as root to the zimbra server
    ssh -T root@192.168.1.132  <<NOMORE > /tmp/ssh.log 2>&1
    
    #Start the zimbra server
    su - zimbra
    zmcontrol start
    
    #Log out of the zimbra server
    NOMORE
    
    exit 0
    I added redirection on the script to see if that has any effect.
    Yeah, I tried that too (not that it makes much sense), but it didn't seem to work...odd...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 5
    Last Post: 04-05-2013, 03:27 PM
  2. Zimbra .pids / service monitoring
    By bin2hex in forum Administrators
    Replies: 24
    Last Post: 04-03-2010, 09:12 PM
  3. LDAP Cannot bind on migration to new server
    By neekster in forum Migration
    Replies: 23
    Last Post: 03-09-2009, 02:08 AM
  4. Debian - Upgrade from 4.5.6
    By magikman in forum Installation
    Replies: 1
    Last Post: 01-19-2008, 12:59 PM
  5. Replies: 5
    Last Post: 04-07-2006, 11:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •