Stopping Apps via ssh
-
- Posts: 155
- Joined: 02 Jan 2016 01:20
Stopping Apps via ssh
Hi there,
it seems that I have created an EasyScripting app that kills everything and makes zway ununsable (it was the seconds that I hit "run" I realized that this would result in a royal clustermess.
I haven't found any documentation so far how I can stop/kill zway and stop the app via textfile edit and restart zway. Alternatively: where are the EasyScripting apps located as textfile? My "find" magic was not sufficient for this
Thanks, zway is currently pauting at 100% CPU and refusing to talk to me
best regards,
rws
it seems that I have created an EasyScripting app that kills everything and makes zway ununsable (it was the seconds that I hit "run" I realized that this would result in a royal clustermess.
I haven't found any documentation so far how I can stop/kill zway and stop the app via textfile edit and restart zway. Alternatively: where are the EasyScripting apps located as textfile? My "find" magic was not sufficient for this
Thanks, zway is currently pauting at 100% CPU and refusing to talk to me
best regards,
rws
-
- Posts: 155
- Joined: 02 Jan 2016 01:20
Re: Stopping Apps via ssh
Hi there,
managed to find my culprit, but I had to resort to violence. This is just in case, somebody else has the same problem.
Firstly, everything seems to be stored in /opt/z-way-server/automation/storage/configjson-xy.json, I only found that by using
whereas my text-to-find was a code-part I knew by heart. I then placed a syntax error so the script would fail. That allowed my to access my gui again.
Nerves wrecked for a moment for sure
Regards,
rws
managed to find my culprit, but I had to resort to violence. This is just in case, somebody else has the same problem.
Firstly, everything seems to be stored in /opt/z-way-server/automation/storage/configjson-xy.json, I only found that by using
Code: Select all
find / -type f -exec grep -H 'text-to-find-here' {} \;
whereas my text-to-find was a code-part I knew by heart. I then placed a syntax error so the script would fail. That allowed my to access my gui again.
Nerves wrecked for a moment for sure
Regards,
rws
Re: Stopping Apps via ssh
To see the status of Z-Way:
To stop Z-Way:
To restart Z-Way:
To start Z-Way:
Code: Select all
sudo systemctl status z-way-server
Code: Select all
sudo systemctl stop z-way-server
Code: Select all
sudo systemctl restart z-way-server
Code: Select all
sudo systemctl start z-way-server
-
- Posts: 155
- Joined: 02 Jan 2016 01:20
Re: Stopping Apps via ssh
Thanks, but you misunderstood, I was asking how to suspend APPS in ZWay via ssh. Not how to stop and resume ZWay.
Re: Stopping Apps via ssh
ridewithstyle wrote: ↑07 May 2022 06:02Thanks, but you misunderstood, I was asking how to suspend APPS in ZWay via ssh. Not how to stop and resume ZWay.
I provided the Z-Way portion as you specifically mentioned stopping and restarting Z-Way. So the commands I provided are exactly how you handle Z-Way. The app you speak of could just be a process that gets triggered. So if that is the case, restarting Z-Way may not start the app app unless it gets triggered to start it.I haven't found any documentation so far how I can stop/kill zway and stop the app via textfile edit and restart zway.
To see what processes are running and if it is using a lot of CPU time, then you can use the ps command along with grep to get rid of processes with no CPU time.
Code: Select all
ps -ef | grep -v 00:00
Code: Select all
sudo kill -9 [i]PID[/i]
Code: Select all
sudo kill -9 38247
-
- Posts: 155
- Joined: 02 Jan 2016 01:20
Re: Stopping Apps via ssh
Hi there, I really appreciate the effort, but the app - due to my error - was constantly triggered, so I needed it to be deactivated. I don't know yet where the status is if an app, once I find that out, I'll post it here for reference.
Re: Stopping Apps via ssh
When the app is active use top and ps to see if you can find it. If you can see it listed, then you can kill it.
-
- Posts: 155
- Joined: 02 Jan 2016 01:20
Re: Stopping Apps via ssh
top only showed the z-way-server at 105% CPU, nothing more.
To clarify further what my question was: what is the equivalent to do from the console when I can't click on this "suspend" Button anymore
-
- Posts: 181
- Joined: 02 Mar 2020 22:41
Re: Stopping Apps via ssh
Z-Way does not have a friendly shell command to stop/start a specific script that runs as part of the EasyScripting module. It can be done, but it's not pretty.
Run the following shell commands as root, replace BAD_SCRIPT in 2 places and ZWAY_ADMIN_PASSWORD:
Explanation:
1. The first command makes a backup copy of your configuration file. This is an important safety measure that allows you to easily revert back to your original configuration.
2. The second command "edits" the configuration file by changing the status of BAD_SCRIPT (from active:true to active:false). Replace BAD_SCRIPT in 2 places with the name of the script you want to deactivate.
3. The last command tells Z-Way to stop the EasyScripting module, reload the module and re-read the configuration data for the module (i.e., BAD_SCRIPT will not run since active has been changed to false). Replace ZWAY_ADMIN_PASSWORD with your Z-Way admin password.
Run the following shell commands as root, replace BAD_SCRIPT in 2 places and ZWAY_ADMIN_PASSWORD:
Code: Select all
# cp /opt/z-way-server/automation/storage/configjson*json /opt/z-way-server/automation/storage/configjson_`date +%F_%T`
# sed -i /opt/z-way-server/automation/storage/configjson*json -e s/'"EasyScripting","active":true,"title":"BAD_SCRIPT"'/'"EasyScripting","active":false,"title":"BAD_SCRIPT"'/
# curl -s -u admin:ZWAY_ADMIN_PASSWORD --globoff '127.0.0.1:8083/ZAutomation/api/v1/modules/reinitialize/EasyScripting'
1. The first command makes a backup copy of your configuration file. This is an important safety measure that allows you to easily revert back to your original configuration.
2. The second command "edits" the configuration file by changing the status of BAD_SCRIPT (from active:true to active:false). Replace BAD_SCRIPT in 2 places with the name of the script you want to deactivate.
3. The last command tells Z-Way to stop the EasyScripting module, reload the module and re-read the configuration data for the module (i.e., BAD_SCRIPT will not run since active has been changed to false). Replace ZWAY_ADMIN_PASSWORD with your Z-Way admin password.
-
- Posts: 155
- Joined: 02 Jan 2016 01:20
Re: Stopping Apps via ssh
Excellent, thank you!
I figured that the script status must be in the same file as the script itself was embedded into the configjson. Me adding a syntax error was just the lazy way to edit that huge textfile. Haven't seen vim slowing down for quite a long time to be honest.
Maybe this helps as documentation in case somebody else breaks his/her EasyScripting app.
Thanks again,
BR,
rws
I figured that the script status must be in the same file as the script itself was embedded into the configjson. Me adding a syntax error was just the lazy way to edit that huge textfile. Haven't seen vim slowing down for quite a long time to be honest.
Maybe this helps as documentation in case somebody else breaks his/her EasyScripting app.
Thanks again,
BR,
rws