nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

Cannot execute a script

This is a discussion on Cannot execute a script within the Mail Servers forums, part of the Mastering Servers category; Hi All, I am writing a script which will start the postfix services on some set of servers. For example ...


Go Back   nixCraft Linux Forum > Mastering Servers > Mail Servers

Linux answers from nixCraft.


Mail Servers Discussion on Postfix/Sendmail Mail servers and related program such as IMAP/POP3, Anti-Spam technologies.

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-24-2009, 12:01 PM
Member
User
 
Join Date: Jul 2007
Location: Hyderabad
OS: Redhat RHEL, Solaris
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 3
vaibhav.kanchan is on a distinguished road
Default Cannot execute a script

Hi All,

I am writing a script which will start the postfix services on some set of servers. For example , I do not want to log in to server and start the postfix service remotely for time convenience. I have written the below script.


Code:
#!/bin/sh
for i in `cat /home/vaibhavk/iad`; do
       echo -n "$i -"
       if ping -nqc 2 $i >/dev/null; then
       ssh $i 'date ; /usr/local/etc/rc.d/postfix reload '
           echo -n " " ; ssh root@$i 'date'
       else
           echo " unreachable..."
       fi
done
Code:
 cat iad
system1.abc.com
system2.abc.com
system3.abc.com

I am getting the below error when I am trying to execute the script
%sh postfix.sh
system.abc.com -Wed Jun 24 06:22:52 UTC 2009
eval: cannot open /var/spool/postfix/pid/master.pid: Permission denied
postfix not running? (check /var/spool/postfix/pid/master.pid).
^C


harry# sh postfix.sh (root priviledges) [script is saved on harry.abc.com]
system.abc.com -Password:
Password:

Could you please figure out the issue in the above script.

Regards,
Vaibhav

Last edited by nixcraft; 06-24-2009 at 04:35 PM.
Reply With Quote
  #2 (permalink)  
Old 06-24-2009, 04:36 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,695
Thanks: 11
Thanked 243 Times in 183 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

To restart postfix use
Code:
/usr/local/etc/rc.d/postfix restart
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
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

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


Similar Threads

Thread Thread Starter Forum Replies Last Post
How to execute shell script from any where kar Shell scripting 3 05-19-2009 04:10 AM
Shell Script To Add Execute permission to the file for the user midomax Shell scripting 5 03-12-2009 12:35 AM
Execute UNIX Command / Shell Script Once In The Future permalac Shell scripting 2 08-27-2008 08:13 PM
If file modified execute a script karabaja Shell scripting 3 11-23-2006 02:39 AM
#why following cannot be execute? ryan Shell scripting 7 03-16-2005 06:50 PM


All times are GMT +5.5. The time now is 12:52 AM.


Powered by vBulletin® Version 3.8.5 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2009 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38