Shock dynamics in relativistic jets