A set of tools that helps to analyze state of spectrometry devices and notify about important events.
Mossbauer laboratory event watcher and notifier, used for add some specific controls (custom) over Mossbauer spectrometric devices.
SM2201spectrometer controlled by software that is running onWindows 98- Target Platform where
Wissance.MossbauerLab.Watcheris running -Raspberry Pi (v2)+Raspbianas OS
Messbauer spectraaccumulation process (monitoring auto save process) fromSM2201spectrometer (controll by date+time) of file last change (onWindows98machine system clock must be set right)
- Send fresh (-2h of Date,Time) spectra by e-mail and Telegram bot (NOT IMPLEMENTED YET)
- Analyze power loss (NOT IMPLEMENTED YET)
There are 2 run profiles (Development and Production) and 2 possible configs variants of Wissance.Mossabuer.LabWatcher:
-
Running on Windows allows to use Net Directory class with network path to files && folders, therefore
SM2201config section looks like:"Sm2201SpectraStoreSettings": { "Address": "192.168.10.212", "Domain": "MOSSBAUERLAB", "Folder": "Autosaves", "UserCredentials": null }
-
Running on any Linux requires to mount Windows shared folder using
cifs.mount, becauseDirectoryin Linux doesn't understand Windows network Path, thereforeSM2201config section looks like:"Sm2201SpectraStoreSettings": { "Address": "", "Domain": "MOSSBAUERLAB", "Folder": "/mnt/sm2201/dev", "UserCredentials": null }
Solution could be run either on Windows or Linux
- Configure SMB (/etc/samba/smb.conf) as follows, add to
globalsection:client min protocol = NT1client lanman auth = yesclient ntlmv2 auth = noTo check is there access to shared folder usingsmbclientuse following command
Where:smbclient //MICHAEL/Autosaves -m NT1 -w MOSSBAUERLAB
MICHAEL- computer nameMOSSBAUERLAB- workgroup nameAUTOSAVES- name of shared folder
- To watch save process we monitor windows shared folder but in linux we have to mount shared folder using
cifs(All names must be Uppercase):sudo mount -t cifs -o user=guest,pass=,vers=1.0,sec=none,domain=MOSSBAUERLAB,ip=192.168.10.217,servern=MICHAEL //MICHAEL/AUTOSAVES /mnt/sm2201/devWhere:MICHAEL- computer nameMOSSBAUERLAB- workgroup nameAUTOSAVES- name of shared folder
- Configure
appsettings.Production.jsonbefore run and setAddressto "" and setFolderto mount point if you are running solution onRaspberry Pi - Run solution
dotnet Wissance.MossbauerLab.Watcher.Web.dll --environment=Production
To run Wissance.MossbauerLab.Watcher.Web as a service it should be configured as systemd service:
- Create group -
sudo groupadd mossbauer - Create user -
labwatcher - sudo useradd -r -g mossbauer -d /usr/local/sbin/labwatcher -s /sbin/nologin labwatcher - Create labwatcher.service file with following content:
[Unit]
Description=Wissance.MossbauerLab.Watcher service
After=syslog.target network.target
Before=httpd.service
[Service]
WorkingDirectory=/usr/local/sbin/labwatcher/app
User=labwatcher
Group=mossbauer
LimitNOFILE=102642
PIDFile=/var/run/mossbauer/labwatcher.pid
ExecStart=dotnet /usr/local/sbin/labwatcher/app/Wissance.MossbauerLab.Watcher.Web.dll --environment=Production
StandardOutput=syslog
StandardError=syslog
[Install]
WantedBy=multi-user.target
- Change directory owner to
mossbauer:labwatcher-sudo chown -R labwatcher:mossbauer /usr/local/sbin/labwatcher - Copy
labwatcher.servicefile to/etc/systemd/system - Execute
sudo systemctl daemon-reload - Execute
sudo systemctl enable labwatcher - Execute
sudo systemctl start labwatcher
- If we are mount automatically and got error like:
Jan 08 18:14:32 LabControl mount.sh[495]: mount error(101): Network is unreachable
Jan 08 18:14:32 LabControl mount.sh[495]: Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) ...
there are many solutions but for me helpful was adding sleep 20s in .sh script prior to mount
