This will work for a bunch of "Duplicate entry" errors, change to anything you like

while :; do while mysql -e 'show slave status\G'|grep "Duplicate entry"; do mysql -e 'stop slave; SET GLOBAL sql_slave_skip_counter = 1; start slave; select sleep(2);'; sleep 1; done; done