logrotate for z-way-server
-
killall -HUP z-way-server, this command will ask the process z-way-server to "reload" and doing that, it will release the "lock" on the log file IF the application if locking the file OR just "appending" data at the end without locking!
The HUP parameter in KILL is not reloading the application ITSELF like a stop/start. The kill signal, is send to the process and ask the application IF he want to reload!
If the program/application/daemon/whatever have NO function on how to "reload", it will do nothing at all, but in case it can handle the reload, it's always like a restarting the process.
If I'm doing a KILL -HUP to a webserver like Apache or nGinx, it will reload the configuration for changes.
All I'm saying, it's that killing -HUP a process for log rotation is not required if the application didn't lock the file. You can try that by doing the command
> logfilename
This will empty the file, if the filesize is the same even after that, the file is lock at the filesystem level and if the file is back to 0, that mean the file is empty with no lock and you don't need to kill HUP the process!
-
I had to go and check this. It rather depends on the server it's directed at. Apache will re-read, for example, but not restart. I have no idea what the z-wave-server will do but it should be really easy to tel by running it and seeing the process details in ps
C
To illustrate this, I took a screenshot of my VM ps aux: I reloaded openLuup 2 days ago.
I have been doing daily log rotate on z-way-server but have booted it since April 10th, date at which I upgraded to 3.0.6
@DesT, I tried without the kill HUP process... It does not work. The log file is actually "moved" by the logrotate and it just stops logging. This is also well documented by @PoltoS on the zwave.me forum and follows their recommendations there.
-
No it does not kill the server, it signals to the z-way-server that it needs to start a new log file.
The vera runs an equivalent command with its log rotation by the way.@prophead said in logrotate for z-way-server:
OT, could I use this make automated backups of my openluup user_data file?
Hmm for this I would use a crontab. Can start another thread if you want or need.
These are some examples:
-
@prophead said in logrotate for z-way-server:
could I use this make automated backups of my openluup user_data file?
Just to say that openLuup has a built-in CGI to accomplish this (files backed up to the cmh-ludl/backups/ folder in LZAP compressed form by default.) These may be used to directly restore an openLuup configuration. You could trigger the backup with a timed scene.
The openLuup console Backup page shows the available backups...
-
@prophead said in logrotate for z-way-server:
could I use this make automated backups of my openluup user_data file?
Just to say that openLuup has a built-in CGI to accomplish this (files backed up to the cmh-ludl/backups/ folder in LZAP compressed form by default.) These may be used to directly restore an openLuup configuration. You could trigger the backup with a timed scene.
The openLuup console Backup page shows the available backups...
-
I use the backups manually. I want automated with rotation. Why hack lua to do this if its easy in os?
@prophead said in logrotate for z-way-server:
I want automated with rotation.
The openLuup plugin has a
SendToTrash
action which internally uses a file retention manager which can limit the number of files in a folder to:- the most recent N
- files younger than a certain number of days old
- only certain file types
Again, this can be run from a regularly scheduled scene. Files are temporarily moved to the Trash folder but may be permanently deleted by the
EmptyTrash
action of the openLuup plugin.The same procedure can be used to manage image files.
I don't call this 'hacking Lua'
-
@prophead said in logrotate for z-way-server:
could I use this make automated backups of my openluup user_data file?
Just to say that openLuup has a built-in CGI to accomplish this (files backed up to the cmh-ludl/backups/ folder in LZAP compressed form by default.) These may be used to directly restore an openLuup configuration. You could trigger the backup with a timed scene.
The openLuup console Backup page shows the available backups...
-
Can't seem to get the SendToTrash action to work either, heres my attempt:
luup.call_action ("openLuup","SendToTrash",{Folder="/etc/cmh-ludl/backup",MaxDays="",MaxFiles="10",FileTypes="lzap"},2)
I really wish you would put examples in your documentation.
the log files showluup_log:2: applying file retention policy... luup_log:2: ...finished applying file retention policy
but the files are still there.
Any help?
|-<:) -
@akbooer So I'm trying to do rotated backups the openLuup way, and expected backup to be an action. Apparently not. What is the best way to call a local cgi?
luup.inet.wget(http://127.0.0.1/backup.cgi)?
@prophead said in logrotate for z-way-server:
expected backup to be an action. Apparently not.
Yes, I would have expected that too... except that we are talking about a Vera feature here, which is used by the AltUI interface, so it has to be done this way to be compatible.
What is the best way to call a local cgi?
In this case, you need:
luup.inet.wget "/cgi-bin/cmh/backup.sh?"
HTH
-
Can't seem to get the SendToTrash action to work either, heres my attempt:
luup.call_action ("openLuup","SendToTrash",{Folder="/etc/cmh-ludl/backup",MaxDays="",MaxFiles="10",FileTypes="lzap"},2)
I really wish you would put examples in your documentation.
the log files showluup_log:2: applying file retention policy... luup_log:2: ...finished applying file retention policy
but the files are still there.
Any help?
|-<:)@prophead said in logrotate for z-way-server:
Can't seem to get the SendToTrash action to work either, heres my attempt:
Yes indeed, another appallingly badly documented feature.
In order to prevent an ill-advised programmer from wreaking havoc, absolute paths are not allowed. So you should use:
luup.call_action ("openLuup","SendToTrash",{Folder="backup",MaxDays="",MaxFiles="10",FileTypes="lzap"},2)
In addition, certain key folders are denied access, including
openLuup, cgi, cgi-bin, cmh, historian, whisper, files, icons, www
I will try to improve the documentation.
-
@prophead said in logrotate for z-way-server:
Can't seem to get the SendToTrash action to work either, heres my attempt:
Yes indeed, another appallingly badly documented feature.
In order to prevent an ill-advised programmer from wreaking havoc, absolute paths are not allowed. So you should use:
luup.call_action ("openLuup","SendToTrash",{Folder="backup",MaxDays="",MaxFiles="10",FileTypes="lzap"},2)
In addition, certain key folders are denied access, including
openLuup, cgi, cgi-bin, cmh, historian, whisper, files, icons, www
I will try to improve the documentation.