Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
  #1 (permalink)  
Old 05-18-2008, 08:51 PM
mlissner mlissner is offline
Member
 
Join Date: Sep 2007
ZCS Version: 5.0.5_GA_2201.UBUNTU6 UBUNTU6 FOSS edition
Posts: 14
mlissner is on a distinguished road
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.
Reply With Quote
  #2 (permalink)  
Old 05-19-2008, 12:56 AM
webman's Avatar
webman webman is offline
Special Member
 
Join Date: Oct 2007
Location: County Durham, UK
ZCS Version: 5.0.7_GA_2444.UBUNTU6_64 FOSS
Posts: 120
webman is on a distinguished road
Send a message via MSN to webman Send a message via Skype™ to webman
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 » Flickr | Last.fm | Del.icio.us | Twitter
Reply With Quote
  #3 (permalink)  
Old 05-19-2008, 01:23 AM
uxbod's Avatar
uxbod uxbod is offline
Moderator
 
Join Date: Nov 2006
Location: Northampton, UK
ZCS Version: Release 5.0.7_GA_2450.RHEL5_20080630192737 CentOS5 NETWORK edition (Unsupported OS)
Posts: 1,354
uxbod is on a distinguished road
Send a message via MSN to uxbod
Default

does the same happen if you do
Code:
su - zimbra -c 'zmcontrol start'
what appears in /var/log/zimbra.log when this happens ?
__________________
Server | CentOS 5.1 | Dual Opteron 250 | Tyan K8W Mobo | 6GB RAM | 3WARE 9550-SX4 | 4 x Samsung 200GB SATA II |
Zimbra | Release Release 5.0.7_GA_2450.RHEL5_20080630192737 NETWORK edition running under Xen 3.2.1 CentOS 5.2 i386 VM |
Network | Cisco 877 Router - Cisco ASA 5505 FW - Cisco 1131AP |
Reply With Quote
  #4 (permalink)  
Old 05-19-2008, 03:06 AM
phoenix phoenix is offline
Zimbra Employee
 
Join Date: Sep 2005
Location: Vannes, France
Posts: 7,406
phoenix is on a distinguished road
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
Reply With Quote
  #5 (permalink)  
Old 05-19-2008, 03:16 PM
mlissner mlissner is offline
Member
 
Join Date: Sep 2007
ZCS Version: 5.0.5_GA_2201.UBUNTU6 UBUNTU6 FOSS edition
Posts: 14
mlissner is on a distinguished road
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.
Reply With Quote
  #6 (permalink)  
Old 05-19-2008, 11:22 PM
uxbod's Avatar
uxbod uxbod is offline
Moderator
 
Join Date: Nov 2006
Location: Northampton, UK
ZCS Version: Release 5.0.7_GA_2450.RHEL5_20080630192737 CentOS5 NETWORK edition (Unsupported OS)
Posts: 1,354
uxbod is on a distinguished road
Send a message via MSN to uxbod
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.
__________________
Server | CentOS 5.1 | Dual Opteron 250 | Tyan K8W Mobo | 6GB RAM | 3WARE 9550-SX4 | 4 x Samsung 200GB SATA II |
Zimbra | Release Release 5.0.7_GA_2450.RHEL5_20080630192737 NETWORK edition running under Xen 3.2.1 CentOS 5.2 i386 VM |
Network | Cisco 877 Router - Cisco ASA 5505 FW - Cisco 1131AP |

Last edited by uxbod : 05-19-2008 at 11:27 PM. Reason: changed working
Reply With Quote
  #7 (permalink)  
Old 05-19-2008, 11:40 PM
mlissner mlissner is offline
Member
 
Join Date: Sep 2007
ZCS Version: 5.0.5_GA_2201.UBUNTU6 UBUNTU6 FOSS edition
Posts: 14
mlissner is on a distinguished road
Default

Well, I figured out how to fix this. I upgraded to the latest version of Zimbra, and tried the script again. All better.
Reply With Quote
  #8 (permalink)  
Old 05-19-2008, 11:41 PM
mlissner mlissner is offline
Member
 
Join Date: Sep 2007
ZCS Version: 5.0.5_GA_2201.UBUNTU6 UBUNTU6 FOSS edition
Posts: 14
mlissner is on a distinguished road
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...
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
LDAP Cannot bind on migration to new server neekster Migration 1 04-28-2008 12:21 PM
Zimbra .pids / service monitoring bin2hex Administrators 16 03-03-2008 02:39 AM
Debian - Upgrade from 4.5.6 magikman Installation 1 01-19-2008 11:59 AM
Problems disconnecting ssh session after zmcontrol stop /start? bowergo Administrators 4 04-11-2007 10:56 AM
Services in Services TAB of Servers are GRAYED out using ZCS-3.1.0_GA_279.FC4 kurt2 Administrators 5 04-07-2006 11:43 AM


freshmeat.net sourceforge.net The best Java IDE



 

Search Engine Optimization by vBSEO 3.0.0