Cron is somehow limited in the way, dates are calculated. There is no easy way to do things like on every month, but only on Mondays.
On systemd-Systems, there is a timer active, that triggers the unattended-upgrades job daily. Following shows the process to setup UA accordingly to update all packages on system from all sources, on the first Wed every month at 2:50am and – if reboots required – reboot at 3am.
apt install unattended-upgrades
/etc/apt/apt.conf.d/10periodic
APT::Periodic::Update-Package-Lists „1“;
APT::Periodic::Download-Upgradeable-Packages „0“;
APT::Periodic::AutocleanInterval „0“;
APT::Periodic::Enable „1“;
APT::Periodic::Unattended-Upgrade „1“;
Unattended-Upgrade::Automatic-Reboot-Time „03:00“;
Unattended-Upgrade::Automatic-Reboot „true“;
Unattended-Upgrade::Origins-Pattern {
„origin=*“;
};
systemctl edit –full apt-daily.timer
[Unit]
Description=monthly apt download activities
[Timer]
OnCalendar=Wed –-1,2,3,4,5,6,7 02:50:00
Persistent=true
[Install]
WantedBy=timers.target
systemd-analyze calendar –iterations=5 „Wed –-1,2,3,4,5,6,7 02:50:00″
Original form: Wed –-1,2,3,4,5,6,7 02:50:00
Normalized form: Wed –-01,02,03,04,05,06,07 02:50:00
Next elapse: Wed 2024-08-07 02:50:00 CEST
(in UTC): Wed 2024-08-07 00:50:00 UTC
From now: 5 days left
Iteration #2: Wed 2024-09-04 02:50:00 CEST
(in UTC): Wed 2024-09-04 00:50:00 UTC
From now: 1 month 3 days left
Iteration #3: Wed 2024-10-02 02:50:00 CEST
(in UTC): Wed 2024-10-02 00:50:00 UTC
From now: 2 months 0 days left
Iteration #4: Wed 2024-11-06 02:50:00 CET
(in UTC): Wed 2024-11-06 01:50:00 UTC
From now: 3 months 5 days left
Iteration #5: Wed 2024-12-04 02:50:00 CET