LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-05-2013, 05:21 AM   #1
HariharanV
Member
 
Registered: Aug 2010
Posts: 49

Rep: Reputation: 0
I cant able to edit the file from one server to another server.


Hi All,

I am very new for shell script, actually am try to edit the file from master server to client server, but i cant able to edit the client server file. I had use the below command.

ssh -t user@hostename /usr/bin/sudo sh -c 'echo -e "#How long to keep log files (days), maximum is a month\n""#Change no 123456789 dated on 3rd April 2013\n""HISTORY=30" > /etc/sysconfig/sysstat'

Can any one please help me out on this.

Thanks in advance.
Hariharan V.
 
Old 04-05-2013, 08:43 AM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,604

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
It would be easier to use:
Code:
ssh-t user@hostename /usr/bin/sudo sh -c "cat >/etc/sysconfig/sysstat" <<-EOF
    #How long to keep log files (days), maximum is a month
    #Change no 123456789 dated on 3rd April 2013
    HISTORY=30
EOF

The blanks at the beginning of the lines is a "tab" character.

man bash, and look for "here documents"

Last edited by jpollard; 04-05-2013 at 08:46 AM. Reason: first example was really bad - sorry about that.
 
Old 04-08-2013, 08:09 AM   #3
Hariharan
Member
 
Registered: Nov 2004
Location: Bangalore
Posts: 64

Rep: Reputation: 0
Hi jpollard thanks a lot
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Install and Configure Samba Server as File Server on Ubuntu Server 12.04 LXer Syndicated Linux News 0 06-06-2012 01:01 PM
Which config file do I need to edit to disable getting hostname from DHCP server? Arodef Linux - Networking 3 03-18-2011 09:42 PM
Edit index.html file of apache web server sanketpatel.86 Linux - Software 3 08-17-2010 01:34 AM
[PHP] connection to remote server to edit file jonaskellens Programming 12 03-19-2010 11:52 AM
can we configure a Linux server with mail server,file server and web server kumarx Linux - Newbie 5 09-09-2004 07:21 AM


All times are GMT -5. The time now is 06:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration