Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
share|improve this question
    
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? –  Tyr 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
add comment

2 Answers 2

up vote 11 down vote accepted

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

echo 'sudo port install gcc45' | at midnight
share|improve this answer
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
add comment

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
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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