3

I have an application installed on my Samsung NP-RV509 which makes the Fn keys work properly.

I have determined that the startup of this application is the reason for almost 30 extra seconds of booting time.

Can I write a shell/python script (I, myself, can't actually do this as I don't know shell/python programming) that will introduce a delay by maybe using a loop or something and then start the above application? Shall I add/apply this script in startup apps?

This should effectively simulate the running of that program at startup, but it would be delayed in actuality.

How can I achieve this?

Nirmik
  • 7,868
  • Possible duplicate: http://askubuntu.com/questions/28685/how-can-i-delay-a-specific-program-on-startup/ ; also you might want to use this instead of sleep, if you are using a DE like Unity or GNOME. – Glutanimate Oct 26 '12 at 17:37

2 Answers2

5

You can add a delay time with sleep command.

man sleep for more info .

Example

I want to startup a program with delay of 10 seconds. I create an entry in the startup applications with this in command field

sleep 10;/usr/bin/<program name>

Example 2

I want to create a script with the delay (sleep) option and add this script to startup applications

gedit delayscript.sh

and I add these lines

#!/bin/bash 

sleep 10 
/usr/bin/<program name>

save the script and give it executable permissions

chmod +x delayscript.sh

and add it to startup applications (command field) with full path

/home/username/delayscript.sh

NickTux
  • 17,539
1

while this is a great answer:

sleep 30; <app-name> 

It does have one hidden downside: if you ever want to kill the delayed app before it starts to run, it's not anywhere in ps -ef; instead all you see is "sleep 30". And, if you kill that sleep command, rather than preventing the delayed app from running it just makes the app run immediately. So I suggest this alternate script (delay) which, if killed, prevents the delayed app from running:

#!/bin/bash
# easily killable sleep
sleep $1
shift
$@

example:

delay 10m rebuild-database

now, if you decide for some reason to prevent the database from being rebuilt, you can kill the shell script.

Al Ro
  • 111
  • 1