sciLogger Howto

sftpでデータをgetする

$ sftp root@<ip_adr>

ipアドレスはネットワーク内のDHCPサーバーで調べるか、シリアルコンソールでログインしてifconfigで調べる。

sciLoggerのIPが192.168.1.23の場合

$ sftp root@192.168.1.23
Connected to 192.168.1.23.
sftp> ls /home/data/2011/12
/home/data/2011/12/20111216.sec         /home/data/2011/12/2011121616.high      
/home/data/2011/12/2011121617.high      /home/data/2011/12/2011121618.high      
sftp> mget *.sec
sftp> mget *.high

scpでデータを取得する

データを取得するPCで下記コマンドを実行する。

sciLoggerのIPが192.168.1.23の場合
2011/12/16の1秒データおよび高速サンプルデータを取得する。

$ scp root@192.168.1.23:/home/data/2011/12/20111216.sec .
$ scp root@192.168.1.23:/home/data/2011/12/20111216*.high .
呼び出し側PCのカレントディレクトリにファイルが転送される。

下記の例では2016年2月のデータがディレクトリごと全て転送されます。

$ scp -r root@<ip_adr>:/home/data/2016/02 .
このコマンドを実行したマシンのカレントディレクトリに名前が「02」のディレクトリが出来ます。

rsyncでデータを取得する

2016年2月のデータをディレクトリごと取得する。

$ rsync -r root@<ip_adr>:/home/data/2016/02 .

IPアドレス設定

 出荷時設定ではIPアドレスはDHCPで取得します。IPアドレスの下位1バイトがLCDの右下に表示されます。固定IPアドレスの設定をする場合は、rootでログインして/etc/rc.localをvi,nanoなどで編集して下さい。 設定ファイル /etc/rc.local

出荷時設定 DHCP

  1. #!/bin/sh
  2. # static IP
  3. #ifconfig eth0 192.168.1.201 netmask 255.255.255.0
  4. # gateway
  5. #route add default gw 192.168.1.1
  6. # measurement program
  7. /usr/local/bin/mystart

設定例 固定IP gatewayはDHCPから取得

  1. #!/bin/sh
  2. # static IP
  3. ifconfig eth0 192.168.1.201 netmask 255.255.255.0  <ーコメントを外した
  4. # gateway
  5. #route add default gw 192.168.1.1   <ーGatewayの設定も必要な場合はここもコメント外す
  6. # measurement program
  7. /usr/local/bin/mystart

固定IP設定をしてもGatewayアドレスはDHCPから得られます。route -nコマンドでgatewayの設定がされているか確認して下さい。設定されない場合は上記設定例のようにroute addコマンドのコメントを外します。

routeコマンドによるdefault gateway設定の確認

この例では赤字のアドレス192.168.1.1がgatewayとして設定されています。Flagsの文字GがDefault Gatewayを表します。

# route -n 
Kernel IP routing table 
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface 
0.0.0.0         192.168.1.1     0.0.0.0         UG    1024   0        0 eth0 
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0 
192.168.1.1     0.0.0.0         255.255.255.255 UH    1024   0        0 eth0 

設定変更後rebootコマンドなどで再起動すれば反映されます。

DNSサーバー設定

/etc/resolv.confはsystemdによって書き換えられるため直接編集しても再起動すると消えてしまいます。

# cat /etc/resolv.conf

# This file is managed by systemd-resolved(8). Do not edit.
#
# Third party programs must not access this file directly, but
# only through the symlink at /etc/resolv.conf. To manage
# resolv.conf(5) in a different way, replace the symlink by a
# static file or a different symlink.

nameserver 192.168.1.1
固定IPにした場合でも、DNSサーバーのアドレスはLAN内にDHCPサーバーがあればそこから得られて/etc/resolv.confに設定されます。

LAN内にDHCPサーバーが無い、あるいはDNSサーバーを明示したい場合は、/etc/systemd/resolved.confを編集します。

# nano -w /etc/systemd/resolved.conf

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See resolved.conf(5) for details

[Resolve]
DNS=192.168.xxx.yyy    <----ここに設定する
#FallbackDNS=8.8.8.8 8.8.4.4 2001:4860:4860::8888 2001:4860:4860::8844
#LLMNR=yes

下記コマンドでサービスを再起動すれば設定が反映されるようですが、rebootした方が確実かもしれません。

systemctl restart systemd-resolved.service

参考リンク

ネタ元はココです。

ネームサーバーを変更する - Qiita http://qiita.com/coreos/items/f9fcee8b639c35b2cc36#%E3%83%8D%E3%83%BC%E3%83%A0%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC%E3%82%92%E5%A4%89%E6%9B%B4%E3%81%99%E3%82%8B