What action to use for when a post is saved / published, with a caveat

Check if ( defined( 'DOING_CRON' ) && DOING_CRON ), which will be true if the post save is triggered during a scheduled cron job.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)