I tested the following command on stock Android 5.0 and 6.0.1, CM 14, and Android 8.1.0 with graceful shutdown and reboot to recovery:
su -c 'svc power reboot recovery'
It worked on Android 4.4.2 as well but the shutdown appeared to be low-level. It requires root access though.
Alternatively, if you're running Android KitKat or above* and have root access, you can try this command in a terminal app:
su -c 'setprop sys.powerctl reboot,recovery'
- replace su -c with adb shell to run the command using adb
- replace reboot,recovery with reboot to reboot the device
- replace reboot,recovery with shutdown to shutdown the device
Note that all of those
setprop commands would do a low-level (unclean; not graceful) shutdown/reboot.
In Android Lollipop and above*, you can also try:
su -c 'setprop ctl.start pre-recovery'
For Android Jelly Bean and below, SS-3's answer appears to be the only possible solution.
* The last version on which the command is tested upon is stock Android 6.0.1.