2

is there any elegant way to start a program 5 minutes after boot?

for example start :

  1. Start chrome 5 minutes after boot
  2. Start Outlook 15 minutes after boot
  3. Start BlueStacks 20 minutes after boot

thank you

I found startup delayer but I am wondering if there are other solutions..

  • 8
    If this is Windows, have you tried using Task Scheduler? – user304064 May 30 '14 at 19:29
  • 1
    Outlook and BlueStacks is only available for Windows => OS is presumably Windows – nixda May 30 '14 at 19:59
  • Actually both Outlook and BlueStacks are also available for Mac – Jonny Wright Sep 23 '14 at 0:23
3

In Windows 7;

Start

Task Scheduler (In search bar within Start Menu)

Create Task

Triggers tab

New

Begin the task: At logon/At startup

Tick Delay task for:

Enter 5 minutes (or whatever time for each task)

OK

Actions tab

Action: Start a program

Browse

Choose app

OK

General tab

Choose a name

OK

Done

  • Any problems let me know – Jonny Wright May 31 '14 at 8:58
2

If Windows:

Task Scheduler is your best bet, and this is a good resource (and yes, I did just copy those links from the comments on the question. Credit where credit is due).

But really, Googling "task scheduler" should give you a wealth of helpful information. Since Task Scheduler comes by default with Windows, and it's put out by Microsoft, favor links to Microsoft's sites (as their documentation will be more extensive).

edit: I would also refer you to Jonny Wright's answer, as it gives a helpful and clear walkthrough.

If Linux / UNIX

You'll want to use cron or at. Be aware than the crontab syntax for per-user crontab is not the same as for global crontab, and if you put scripts in /etc/cron.daily/ or one of the other frequency-specific cron directories you can use any format of script.

You can also simply add the functionality you want to one of the init scripts (or, better yet, write your own init script) that forks a subprocess which performs the action you want.

For example, putting a file like the one below under /etc/init.d would cause it to run at boot time:

#!/usr/bin/env bash
mything ()
{
    # Wait five minutes; 5 * 60 seconds
    sleep $(( 5 * 60 ))
    # Do the thing you want to do
    exampleprogram exampleArg1 exampleArg2
}
mything & >/dev/null

All of those links, by the way, are just to manpages, so to access them you'd use: man 1 crontab (for per-user crontab syntax), man 5 crontab (for global crontab syntax), man cron (for cron syntax), and man at (for at syntax).

Either Way

Be aware that, to schedule an event relative to the boot time of the machine you will need administrative / superuser privileges, while you won't need admin privileges to schedule an event relative to your own login time.

  • "Always quote the most relevant part of an important link, in case the target site is unreachable or goes permanently offline." – and31415 May 30 '14 at 19:50
  • @and31415 Better? – Parthian Shot May 30 '14 at 19:56
  • The Linux part looks good to me. If you want to put a link pointing to an external source, that's fine; just make sure to include some excerpts, too. This way you get a self-contained answer. – and31415 Jun 2 '14 at 13:40

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.