I need to compile gcc45 on my computer and that's a lengthy and resource-intensive process for my computer, so I'd prefer to have it do it while I sleep (at night).

What's the closest thing to:

$ @2300 sudo port install gcc45
  • Why not just start the process when you're leaving the computer for the night. e.g. run command, walk away. – xenoterracide Apr 10 '11 at 9:34
  • On a related note, sudo asks me for a password. How can I provide sudo with my password in a secure way? – Theo Belaire Apr 10 '11 at 14:43
  • @Tyr I would run the command in expect and load the password from a file with 0400 permissions. But you can also have add the NOPASSWD sudo tag for just specific commands. – Arcege Apr 11 '11 at 1:08
  • Perhaps I'm missing something, but why not use a cron job? – Faheem Mitha Apr 11 '11 at 8:28

The traditional unix command at is usually used for this purpose. e.g.

echo 'sudo port install gcc45' | at midnight
  • 1
    +1 for at; one problem with any of the 'later' solutions will be if the program (including sudo) requires terminal input. The process will either fail or be stopped on SIGTTIN. Make sure that if you are using sudo, to have the appropriate NOPASSWD tag in the sudoers file. – Arcege Apr 11 '11 at 1:05

On a mac:

  1. Wrap the command in an executable script
  2. Create an iCal event @2300 and choose as alarm 'run script'
  3. Leave the computer on and at @2300 the script will execute

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.