Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

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
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
up vote 6 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
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 ?


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
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


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.