4. Synchronization#
A synchronization run reads the school data from the LDAP directory, writes it to CSV files, packs the files into a ZIP archive, and uploads the archive to Apple School Manager. This chapter describes the run itself and the data that it transfers.
4.1. Run the synchronization#
Three things start a synchronization run:
The cron job from Schedule the synchronization.
Saving the app settings, if you enabled
asm/run_on_appsetting_save.The command asm-upload on the command line.
$ /usr/sbin/asm-upload
The command writes progress messages to the terminal
and a more detailed log to /var/log/univention/asm.log.
It exits with a non-zero status
if the credentials are missing
or if the upload to any account fails.
4.1.1. What happens during a run#
The connector reads the settings file
/etc/asm-connections.json, as described in Settings file. A missing or invalid entry stops the run, and so does a school that doesn’t exist in the LDAP directory.The connector collects the schools, classes, work groups, teachers, and students from the LDAP directory, restricted to the schools of the account and by the LDAP filters from Select users with an LDAP filter.
The connector writes the six CSV files from The CSV files to a temporary directory.
The connector packs the CSV files into
/var/lib/asm/asm_TIMESTAMP.zipand removes the temporary directory.TIMESTAMPis the time the connector created the archive, in ISO 8601 format, for example2026-10-01T03:00:12.345678.The connector opens an SFTP connection to
upload.appleschoolcontent.comand uploads the archive asarchive.zip. It verifies the host key against/etc/asm_public_key.The connector sets
asm/last_uploadandasm/last_upload/ACCOUNTto the current time and deletes the archive, unless you enabledasm/store_zip.
With several accounts, the connector repeats the steps 2 to 6 for each account.
Every run transfers the complete data set. The connector doesn’t track what changed since the last run.
4.1.2. How Apple School Manager applies the data#
Apple School Manager compares the uploaded data with the accounts that it holds:
A user who appears for the first time gets a new account.
A user who is no longer in the upload is deactivated immediately and deleted after 30 days.
A user whose attributes changed keeps the account, as long as the
person_idcolumn is unchanged. See Identification of users.
4.2. The CSV files#
The archive contains the following six files. Apple documents their format in Apple Inc. [4]. The connector sorts the rows of each file by school and then by user or class name.
File |
Content |
|---|---|
|
One row per school. |
|
One row per school class and work group. |
|
One row per school class and work group, with the teachers of that class. |
|
One row per teacher. |
|
One row per student. |
|
One row per membership of a student in a school class or work group. |
4.2.1. Locations#
Column |
Source in UCS@school |
|---|---|
|
Name of the school, for example |
|
Display name of the school. Falls back to the name if the school has no display name. |
4.2.2. Courses#
Apple School Manager requires every class to belong to a course.
UCS@school only has the school class or work group,
so the connector exports each of them twice:
once as a course in courses.csv
and once as a class of that course in classes.csv.
Both rows use the name of the group as their ID,
so each course has exactly one class.
Column |
Source in UCS@school |
|---|---|
|
Name of the school class or work group,
including the school prefix, for example |
|
Same value as |
|
Built from |
|
Name of the school. |
4.2.3. Classes#
Column |
Source in UCS@school |
|---|---|
|
Name of the school class or work group. |
|
Empty by default.
See |
|
Name of the school class or work group. |
|
The |
|
The |
|
Name of the school. |
Note
Apple School Manager supports at most 15 teachers per class. If a class has more, the connector synchronizes the first 15 and writes a warning to the log file.
4.2.4. Staff#
Column |
Source in UCS@school |
|---|---|
|
The attribute from |
|
Same value as |
|
First name of the teacher. |
|
First value of |
|
Last name of the teacher. |
|
Primary email address,
modified by |
|
User name of the teacher. |
|
Primary school of the teacher. |
|
The other schools of the teacher, in alphabetical order. |
The file holds teachers and teachers with an additional staff role. Staff members without a teacher role aren’t part of the export.
4.2.5. Students#
Column |
Source in UCS@school |
|---|---|
|
The attribute from |
|
Same value as |
|
First name of the student. |
|
First value of |
|
Last name of the student. |
|
The attribute from |
|
Primary email address,
modified by |
|
User name of the student. |
|
The value of |
|
Primary school of the student. |
|
The other schools of the student, in alphabetical order. |
Exam users aren’t part of the export.
4.2.6. Rosters#
Column |
Source in UCS@school |
|---|---|
|
The class name and the |
|
Name of the school class or work group. |
|
The |
The file only holds students.
Teachers reach a class through the instructor_id columns of
classes.csv.
4.3. Inspect the uploaded data#
To look at what the connector uploads,
enable asm/store_zip in the app settings
and run the synchronization.
The connector then keeps the archive in /var/lib/asm/.
$ ls -l /var/lib/asm/
$ unzip -d /var/tmp/asm "$(ls -t /var/lib/asm/*.zip | head -1)"
Caution
The archives contain personal data.
Delete them when you no longer need them,
and turn asm/store_zip off again.