Disk accretion is a natural consequence of rotation and gravity. It occurs in many astrophysical objects. An empirical correlation is found between the mass accretion rate and the accretor mass, from brown dwarfs to AGNs. However, some objects are seen to deviate from this correlation, as they are observed in states of low or high accretion activity, spanning several orders of magnitude. These variations are in many cases yet unexplained. Another correlation is observed between the mass accretion and outflow rate. When spatially resolved, jets and outflows contain a fossil record of the variation of the ejection velocity - and hence the accretion activity - up to timescales of ~1000 yr in young stellar objects (YSOs). This allows us to study the accretion/ejection phenomenon in the time domain, often elusive in observational astronomy. I review several spectroscopic studies of the kinematics and physical conditions of jets associated with intermediate-mass (M > 2Msun) YSOs, which have been observed with the optical to near-infrared (300-2500 nm) spectrograph X-shooter on the ESO Very Large Telescope. We have discovered the jet HH1042, associated with a strongly accreting intermediate-mass YSO. This jet reveals an ejection process that is not synchronized between the two sides of the disk, despite similar outflow velocities in both lobes. Furthermore, it does not show a clear periodicity. In contrast, in the Herbig star HD 163296, periodic jet ejections occur every 15 years, and are synchronized between the two sides. In this object, the jet lobes are asymmetric in terms of (shock) velocities and ionization, although their mass outflow rates are similar. The asymmetry may then be a consequence of external conditions, instead of being caused by the launch mechanism itself. Our observations suggest that jet launching in HD 163296 is coupled with dust ejection events, which may in part explain the near-infrared excess emission and variability of this class of objects. I will discuss some possible physical origins of the periodic ejections.