Originally posted by ARA
View Post
Announcement
Collapse
No announcement yet.
[INFO] HS systemd script
Collapse
X
-
Originally posted by integlikewhoa View PostInstructions? I did upgrade mono yesterday from 3.xx to 4.xx to fix some other issues. Instuctions on how to do a complete install would be helpful. Thanks
Code:root@nuc:~# dpkg --get-selections | grep mono ca-certificates-mono install fonts-tlwg-mono install fonts-tlwg-mono-ttf install libmono-2.0-dev install libmono-accessibility4.0-cil install libmono-c5-1.1-cil install libmono-cairo4.0-cil install libmono-cecil-private-cil install libmono-cecil-vb0.9-cil install libmono-cil-dev install libmono-codecontracts4.0-cil install libmono-compilerservices-symbolwriter4.0-cil install libmono-corlib4.5-cil install libmono-cscompmgd0.0-cil install libmono-csharp4.0c-cil install libmono-custommarshalers4.0-cil install libmono-data-tds4.0-cil install libmono-db2-1.0-cil install libmono-debugger-soft4.0a-cil install libmono-http4.0-cil install libmono-i18n-cjk4.0-cil install libmono-i18n-mideast4.0-cil install libmono-i18n-other4.0-cil install libmono-i18n-rare4.0-cil install libmono-i18n-west4.0-cil install libmono-i18n4.0-all install libmono-i18n4.0-cil install libmono-ldap4.0-cil install libmono-management4.0-cil install libmono-messaging-rabbitmq4.0-cil install libmono-messaging4.0-cil install libmono-microsoft-build-engine4.0-cil install libmono-microsoft-build-framework4.0-cil install libmono-microsoft-build-tasks-v4.0-4.0-cil install libmono-microsoft-build-utilities-v4.0-4.0-cil install libmono-microsoft-build4.0-cil install libmono-microsoft-csharp4.0-cil install libmono-microsoft-visualbasic10.0-cil install libmono-microsoft-visualc10.0-cil install libmono-microsoft-web-infrastructure1.0-cil install libmono-oracle4.0-cil install libmono-parallel4.0-cil install libmono-peapi4.0a-cil install libmono-posix4.0-cil install libmono-rabbitmq4.0-cil install libmono-relaxng4.0-cil install libmono-security4.0-cil install libmono-sharpzip4.84-cil install libmono-simd4.0-cil install libmono-smdiagnostics0.0-cil install libmono-sqlite4.0-cil install libmono-system-componentmodel-composition4.0-cil install libmono-system-componentmodel-dataannotations4.0-cil install libmono-system-configuration-install4.0-cil install libmono-system-configuration4.0-cil install libmono-system-core4.0-cil install libmono-system-data-datasetextensions4.0-cil install libmono-system-data-entity4.0-cil install libmono-system-data-linq4.0-cil install libmono-system-data-services-client4.0-cil install libmono-system-data-services4.0-cil install libmono-system-data4.0-cil install libmono-system-design4.0-cil install libmono-system-drawing-design4.0-cil install libmono-system-drawing4.0-cil install libmono-system-dynamic4.0-cil install libmono-system-enterpriseservices4.0-cil install libmono-system-identitymodel-selectors4.0-cil install libmono-system-identitymodel4.0-cil install libmono-system-io-compression-filesystem4.0-cil install libmono-system-io-compression4.0-cil install libmono-system-json-microsoft4.0-cil install libmono-system-json4.0-cil install libmono-system-ldap-protocols4.0-cil install libmono-system-ldap4.0-cil install libmono-system-management4.0-cil install libmono-system-messaging4.0-cil install libmono-system-net-http-formatting4.0-cil install libmono-system-net-http-webrequest4.0-cil install libmono-system-net-http4.0-cil install libmono-system-net4.0-cil install libmono-system-numerics4.0-cil install libmono-system-reactive-core2.2-cil install libmono-system-reactive-debugger2.2-cil install libmono-system-reactive-experimental2.2-cil install libmono-system-reactive-interfaces2.2-cil install libmono-system-reactive-linq2.2-cil install libmono-system-reactive-observable-aliases0.0-cil install libmono-system-reactive-platformservices2.2-cil install libmono-system-reactive-providers2.2-cil install libmono-system-reactive-runtime-remoting2.2-cil install libmono-system-reactive-windows-forms2.2-cil install libmono-system-reactive-windows-threading2.2-cil install libmono-system-runtime-caching4.0-cil install libmono-system-runtime-durableinstancing4.0-cil install libmono-system-runtime-serialization-formatters-soap4.0-cil install libmono-system-runtime-serialization4.0-cil install libmono-system-runtime4.0-cil install libmono-system-security4.0-cil install libmono-system-servicemodel-activation4.0-cil install libmono-system-servicemodel-discovery4.0-cil install libmono-system-servicemodel-internals0.0-cil install libmono-system-servicemodel-routing4.0-cil install libmono-system-servicemodel-web4.0-cil install libmono-system-servicemodel4.0a-cil install libmono-system-serviceprocess4.0-cil install libmono-system-threading-tasks-dataflow4.0-cil install libmono-system-transactions4.0-cil install libmono-system-web-abstractions4.0-cil install libmono-system-web-applicationservices4.0-cil install libmono-system-web-dynamicdata4.0-cil install libmono-system-web-extensions-design4.0-cil install libmono-system-web-extensions4.0-cil install libmono-system-web-http-selfhost4.0-cil install libmono-system-web-http-webhost4.0-cil install libmono-system-web-http4.0-cil install libmono-system-web-mvc3.0-cil install libmono-system-web-razor2.0-cil install libmono-system-web-routing4.0-cil install libmono-system-web-services4.0-cil install libmono-system-web-webpages-deployment2.0-cil install libmono-system-web-webpages-razor2.0-cil install libmono-system-web-webpages2.0-cil install libmono-system-web4.0-cil install libmono-system-windows-forms-datavisualization4.0a-cil install libmono-system-windows-forms4.0-cil install libmono-system-windows4.0-cil install libmono-system-xaml4.0-cil install libmono-system-xml-linq4.0-cil install libmono-system-xml-serialization4.0-cil install libmono-system-xml4.0-cil install libmono-system4.0-cil install libmono-tasklets4.0-cil install libmono-webbrowser4.0-cil install libmono-webmatrix-data4.0-cil install libmono-windowsbase4.0-cil install libmono-xbuild-tasks4.0-cil install libmonoboehm-2.0-1 install libmonoboehm-2.0-dev install mono-4.0-gac install mono-csharp-shell install mono-devel install mono-gac install mono-mcs install mono-runtime install mono-runtime-common install mono-runtime-sgen install mono-vbnc install mono-xbuild install mono-xsp4 install mono-xsp4-base install ubuntu-mono install
Comment
-
I started with Mono 4.x.x so missed the 3.x -> 4.x problems. But I have also heard reports of Mono upgrades breaking HS3 installs. I've kept 4.x.x updated (the minor releases - 4.0.x) and haven't run into any problems yet. And it's always a good idea to keep a backup of the HS3 folder when you start to make changes. I just copy the whole main HomeSeer folder to a backups folder in my home directory.
Here's a list of the Mono packages I have installed:
Code:~:# rpm -qa | grep mono | sort apache2-mod_mono-3.12-3.2.x86_64 dbus-1-mono-0.63-213.8.x86_64 libmono-2_0-1-4.0.4-1.8.x86_64 libmono-2_0-devel-4.0.4-1.8.x86_64 libmonoboehm-2_0-1-4.0.4-1.8.x86_64 libmonoboehm-2_0-devel-4.0.4-1.8.x86_64 libmonosgen-2_0-1-4.0.4-1.8.x86_64 libmonosgen-2_0-devel-4.0.4-1.8.x86_64 mono-addins-1.2-3.10.noarch mono-addins-devel-1.2-3.10.noarch mono-addins-msbuild-1.2-3.10.noarch mono-basic-4.0.1-3.2.noarch mono-complete-4.0.4-1.8.x86_64 mono-core-4.0.4-1.8.x86_64 mono-data-4.0.4-1.8.x86_64 mono-data-oracle-4.0.4-1.8.x86_64 mono-data-sqlite-4.0.4-1.8.x86_64 mono-devel-4.0.4-1.8.x86_64 monodevelop-5.10.0-154.4.x86_64 monodevelop-database-5.10-1.2.noarch monodoc-core-4.0.4-1.8.x86_64 mono-extras-4.0.4-1.8.x86_64 mono-locale-extras-4.0.4-1.8.x86_64 mono-mvc-4.0.4-1.8.x86_64 mono-nunit-4.0.4-1.8.x86_64 mono-reactive-4.0.4-1.8.x86_64 mono-tools-3.10-2.20.noarch mono-uia-2.1-11.2.x86_64 mono-uia-devel-2.1-11.2.x86_64 mono-wcf-4.0.4-1.8.x86_64 mono-web-4.0.4-1.8.x86_64 mono-winforms-4.0.4-1.8.x86_64 mono-winfxcore-4.0.4-1.8.x86_64 patterns-openSUSE-devel_mono-20150918-12.1.x86_64
-Alex
Comment
-
Thank you for this thread. It's a bit cleaner than starting in rc.local, and also allows for a clean shutdown when rebooting the box.
I'm wondering: is there some way to hide the "shutdown" script from HSTouch? I'd hate for my wife to mistakenly shutdown the homeseer server when I'm not home as she'd have no way to get it started again.
Also, in case anyone is interested, you should also be able to put the homeseer.service control file in /usr/local/lib/systemd/system. (I tend to stick any non-distro stuff in /usr/local.)
Take care
Gary
Comment
-
I don't know how to hide events - maybe some combination of virtual devices and user permissions? But as a workaround, you can cause systemd to always restart HS3. In your `homeseer.service` file, change the line:Code:Restart=on-failure
Code:Restart=always
Code:systemctl stop homeseer.service
Thanks for pointing out the alternate unit path, I didn't know about that one. I must remember not to confuse it (/usr/local/lib/systemd/system/) with the system directory (/usr/lib/systemd/system/) as the latter will get overwritten during software instillation and update.
-Alex
Comment
-
I tried the "JSON"-method to perform a shutdown, but I always got an "{ "Response":"Error, running event" }" in return and no shutdown was initiated.
I edited the curl-command in "stop_homeseer.sh":Code:#!/bin/bash /usr/bin/curl 'http://127.0.0.1/LinuxTools' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' --data 'ConfirmShutdownhs=Yes' --compressed sleep 10s
My homeseer.service:Code:[Unit] Description=HomeSeer Server After=network.target [Service] WorkingDirectory=/usr/local/HomeSeer ExecStart=/usr/bin/mono /usr/local/HomeSeer/HSConsole.exe --log ExecStop=/usr/local/HomeSeer/scripts/stop_homeseer.sh Restart=on-failure TimeoutStopSec=90 [Install] WantedBy=multi-user.target
Comment
-
Originally posted by AutomatedJim View PostAbout to implement this solution to cleanly start, stop HomeSeer and rebooting entire RPi3.
Question, is there a way from an HS Event to manually trigger the HS3 to cleanly shutdown and reboot the RPi3 with what is in this thread?
Thanks,
Jim
shutdown -r now
In fact, you may not need this event... There is a reboot option in the menus already, but I'm not entirely sure how that terminates the HS process. Tools > System > Restart System. Maybe somebody with more knowledge of how this works can chime in.
Comment
-
Originally posted by AutomatedJim View PostMissing something.
After copying homeseer.service to lib/systemd/system/, tried to enable, my results:
Code:pi@RPi3-HS3PRO:~ $ systemctl enable homeseer.service Failed to execute operation: Access denied
Thanks,
Jim
This looks like a permission issue. If you have the root account calling the program you will need to provision access to the HS3 program folder and files.
1. Where is your HS3 program folder?
2. Are you using a specific account to start the service in your systemd init command?
Sent from my iPhone using Tapatalk
Comment
-
Originally posted by Kerat View PostThis looks like a permission issue. If you have the root account calling the program you will need to provision access to the HS3 program folder and files.
1. Where is your HS3 program folder?
2. Are you using a specific account to start the service in your systemd init command?
Sent from my iPhone using Tapatalk
Comment
-
As Kerat and Jon pointed out, this is most likely a permissions issue. The systemd `systemctl` command needs to be executed as root. You also mentioned that you put your `homeseer.service` file in `/lib/systemd/system/`. Normally it's recommended to use either `/etc/systemd/system/` or `/usr/local/systemd/system/` for custom configurations.
As for shutting down the entire system, Jon is correct, a HS3 Event that runs a Bash scrip is maybe the simplest way to do it. I would also note that there are the commands `reboot` and `poweroff` in addition to the traditional `shutdown` command - they all will need to be run as root.
ZoRaC has an interesting solution, in that he uses the actual web interface commands to shutdown HS3. This is simpler (and perhaps cleaner) than having a separate VB scrip as described earlier in the thread. I haven't had a chance to test it yet, but look forward to trying it out. It should also be possible to run the commands for system shutdown and restart. Perhaps he can tell us how he determined the exact curl command to send the HS3 interface?
-Alex
Comment
Comment