How do I setup two cron jobs to run every night at 3:00 and 3:10?

Solution 1:

Open a terminal (Ctrl+Alt+T) then run:

crontab -e

If it asks you to select an editor, choose nano. Insert these lines at the end of the file:

 0 3 * * * vboxmanage controlvm virtualpbx acpipowerbutton
 5 3 * * * vboxmanage startvm virtualpbx -type headless

Press Ctrl+O,Return to save the file and Ctrl+X to exit. Then run exit to close the terminal.

EDIT
This is what the OP did:

  1. ssh to server
  2. sudo nano /etc/crontab <key in password>
  3. edit per Eric's recommendation but added the username that starts the VMs as follows...

    0 3 * * * username vboxmanage controlvm virtualpbx acpipowerbutton   
    5 3 * * * username vboxmanage startvm virtualpbx -type headless  
    
  4. CTRL-X to close. Enter to save the crontab.

  5. Restart cron: sudo service cron stop then sudo service cron start.

Solution 2:

Drop to console

Create a bash script, one for each of the commands, (don't forget to make them executable with sudo chmod +x filename.sh) and store them in a place that cron can run them from.

sudo anacron -t 00 03 * * * /path/to/script/script1.sh

sudo anacron -t 10 03 * * * /path/to/script/script2.sh

Enjoy!