replacing old motd with new motd

I need to replace the current /etc/motd text file with a new motd across 30+ servers.

Which is the best way to do this? Shell script? sed?

Does anyone have an example I can use?

Thanks in advance. Unix people are the best!!! :slight_smile:

Quite a few ways of doing it - first you need to know what works in your environment as far as getting the file there with the least amount of typing.

Create your new motd - then either ftp, rcp, scp, or some other way of getting the file to all the servers (push it directly onto the old /etc/motd OR move the original to motd.old and then push your new file). Since the motd isn't needed for booting, you could just overwrite it.

Create a file with the server names and do a shell script that loops through doing the ftp/rcp/scp to each server:

Example (test before using):

#!/bin/csh -f
set servers = `cat /appropriate/path/myserver.list`
foreach x ($servers)
   /appropriate/path/scp /appropriate/path/newmotd $x\:/etc/motd
end
exit

It works!!

Thanks for the quick reply. :smiley: :smiley: :smiley: :smiley: