Hi all,
Pretty new to unimus and still working out some stuff. First thing i wanted to see if i could get an automated backup after the cli terminal is closed. This would allow for kind of a trace of who did what exactly.
I created(with the help of some AI i have to admit) a python script that runs in windows as a service.
I first setup unimus to send syslogs to itself so that the script could listen in on these syslogs.
Next when there is a syslog message stating that a cli session has ended it would get the IP address out of that message.
Then it does an API call for the device list of all devices. Had some issues in looking up a specific device so just looked them all up. Then searched for the ID of the device in that array and did an API call of a backup.
So in summary:
*make unimus send syslog messages to itself(if you run the script on your unimus server)
*install python on windows
*in powershell(admin) install the correct library: "pip install pywin32"
*In the script you will still need to add you API key and if applicable and you are running your script on another device change the IP of your unimus server.
*go to the directory where you placed the py script.
*in same powershell(admin) run python Auto_backup_logout_cli.py install
Standard the service is manual so you need to set it to auto with delay if you want to have it started after you unimus server is booted up.
Hope it helps someone here!
Cheers!
Autbackup after CLI terminal close
- Attachments
-
- Auto backup logout cli.zip
- (2 KiB) Downloaded 1 time