2012-05-16

Scratch of the day - ssh transfer from server to server

There's 2 servers which configured only my workstation is able to login using ssh keys. But I need to transfer files between these 2 servers. Downloading from server A to my workstation then upload the files to server B seems to be way. It would be good if I can combine the 2 operations into 1 single execution.

With shell's pipe, cat & ssh, this is what I've come up with :
ssh bob@server-A.example.com "cat /source/file-or-directory.txt" | \
ssh bob@server-B.example.com "cat > /destination/file-or-directory.txt"

Shalom !!!

2012-05-11

Scratch of the day - exclude logging to /var/log/messages

After telling dhcpd to log messages to local7 of syslogd, "uid lease" messages are still being log in /var/log/messages. This is because by default, syslogd logs "notice" level and above to /var/log/messages.

If you don't wanna see these messages in /var/log/messages, which it has already log to /var/log/dhcpd.log, include the log level "none" that tells syslogd logs to /var/log/messages. This assumed that dhcpd is configured to use log facility "local7" in it's config file, that output all messages to /var/log/dhcpd.log.


Example :
(in /etc/syslog.conf)
----- snip -----
*.notice;authpriv.none;kern.debug;lpr.info;mail.crit;news.err;local7.none   /var/log/messages
----- snip ----

Reload syslogd and monitor /var/log/messages & /var/log/dhcpd.log :

/etc/rc.d/syslogd reload

Namaste !!!