3

I have an application installed for my samsung NP-RV509 installed that makes the fn keys work properly..

I figured it out that it is the reason behind almost 30sec xtra booting time...

so i was wondering if i could write a shell/python script(actually i myself cant as i dont know shell/python prog) that will introduce a delay may be using a loop or something and then start the above application...I shall add this script in start up apps...

this will simulate the running of that program at startup but, delayed in actual...

so how can i achieve this?(help wth the code)

thankyou! :)

Nirmik
  • 7,548
  • 15
  • 56
  • 88
  • Possible duplicate: http://askubuntu.com/questions/28685/how-can-i-delay-a-specific-program-on-startup/ ; also you might want to use [this](http://askubuntu.com/questions/28685/how-can-i-delay-a-specific-program-on-startup/195036#195036) 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
  • 16,759
  • 6
  • 53
  • 65
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