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.

So I have this program which I manually run as root :

sudo gammu-smsd -c /etc/gammu-smsdrc -d 

What this does is it runs the Gammu (software to manage gsm modems) and 'daemonize' it. My problem is I want this program to automatically run on boot up .

Is it ok to just edit root's crontab and stick this command there? Or there's some other way?

(Im using Ubuntu 11.04.)

share|improve this question

migrated from stackoverflow.com Sep 28 '11 at 10:32

This question came from our site for professional and enthusiast programmers.

1  
You probably don't need the sudo when you put it in the startup files since most stuff there is executed by root. –  Johan Sep 28 '11 at 10:38
    
You might first ask yourself if you want that to be run before or after a user logs in. –  rozcietrzewiacz Sep 28 '11 at 11:02
1  
It maybe worth looking at creating init.d scripts for your daemon, However your requirement so up to you. –  whoami Sep 28 '11 at 11:07
    
I would like to run before a user logs in. The thing is I want my server to run my programs (not just gammu) even if im not around during a power failure in which the computer reboots. –  r2b2 Sep 28 '11 at 14:30

3 Answers 3

up vote 5 down vote accepted

How about /etc/rc.local?

This will be executed last in the startup sequence.

share|improve this answer
    
add sleep 1m before gammu-smsd -d. I know this is not recommended, but this is the easy way to make it working. You might need also look for creating init.d script –  GusDeCooL May 15 '13 at 16:50

Here is how on how to add a startup script to be run at bootup. You can find more information here.

share|improve this answer
1  
The link you gave is very outdated. From what I know, the booting procedure has much changed since. –  rozcietrzewiacz Sep 28 '11 at 11:00

May this help you ?

http://www.howtogeek.com/howto/ubuntu/how-to-add-a-program-to-the-ubuntu-startup-list-after-login/


Or just add it in the /etc/profile

or do add it the recommended way : http://embraceubuntu.com/2005/09/07/adding-a-startup-script-to-be-run-at-bootup/

Indeed, remove the sudo ! (but you will need it to do the edit or to add the command, so...)

share|improve this answer
1  
it executes the program after the login, i was hoping something that gets executed before that, or during the login window is shown ,or without needing to login –  r2b2 Sep 28 '11 at 9:49
    
see my edit : add it in the system-wide startup file –  Louis Sep 28 '11 at 10:01
    
Louis: do I need to remove sudo if i follow that guide? –  r2b2 Sep 28 '11 at 14:23

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.