Hi,
Sometime, Nexcloud Desktop disconnects from Nextcloud server. So automatic backup of local files is stopped. Neither users nor admin are informed.
I’ve searched a occ command or dig into MariaDB DB to look for the latest Nexcloud Desktop sync date.
I found an SQL request to find the latest action for a user :
SELECT MAX(timestamp) FROM oc_activity WHERE user='myuser;
The date retrieved is not specific to Nextcloud Desktop client and also concern those connected with the WebUI.
How can I report all Nextcloud Client disconnected from Nextcloud server ?
Some of our users use Nextcloud through WebUI but all are supposed to use it with Nextcloud Desktop to backup their files. Unfortunatly, sometimes, Nextcloud Desktop disconnect and backup are stopped. I would like to know which Nextcloud Desktop are disconnected. Even for users that still upload some files manually through WebUI. Which is not a consistent backup.
Can you explain what oc_authtoken.type and oc_authtoken.remember means ?
Nextcloud is not a backup solution but a synchronization. This is something completely different. It is important to never use words like “backup” to avoid getting the wrong idea about what nextcloud is for.
Once you delete something on your desktop, it will also be deleted in the cloud. As soon as you connect your desktop to the cloud but have lost your files in the meantime, all files in the cloud will also be deleted as they are synchronized. So you have ZERO backup security with a cloud. For this you need other solutions. Even better is to use a NOT synced part of the cloud if you just want to do a “backup”.
oc_ is the table prefix, authtoken is the table and type / remember are the columns.
A solution I found that lists users without Nextcloud Desktop activity from 30 days :
SELECT FROM_UNIXTIME(MAX(last_activity)) AS depuis,uid,name
FROM oc_authtoken
WHERE name LIKE '% (Desktop Client - %' AND last_activity < UNIX_TIMESTAMP(NOW())-60*60*24*30
GROUP BY uid
ORDER BY depuis DESC;
This will not exactly tracks users but Nextcloud Desktop connexions. If a user has more than one computer with Nextcloud Desktop installed, il will appear only once. This can be solved this way where every user appears once for each computer used :
SELECT FROM_UNIXTIME(MAX(last_activity)) AS depuis,uid,CONCAT(uid, '@', name) AS PC
FROM oc_authtoken
WHERE name LIKE '% (Desktop Client - %' AND last_activity < UNIX_TIMESTAMP(NOW())-60*60*24*30
GROUP BY PC ORDER BY depuis DESC;