LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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, 04: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, 07:43 AM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
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 07:46 AM. Reason: first example was really bad - sorry about that.
 
Old 04-08-2013, 07: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 12:01 PM
Which config file do I need to edit to disable getting hostname from DHCP server? Arodef Linux - Networking 3 03-18-2011 08:42 PM
Edit index.html file of apache web server sanketpatel.86 Linux - Software 3 08-17-2010 12:34 AM
[PHP] connection to remote server to edit file jonaskellens Programming 12 03-19-2010 10:52 AM
can we configure a Linux server with mail server,file server and web server kumarx Linux - Newbie 5 09-09-2004 06:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:49 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
Open Source Consulting | Domain Registration