LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Newbie
User Name
Password
Linux - Newbie This forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Tags used in this thread
Popular LQ Tags , , ,

Reply
 
Thread Tools
Old 01-21-2007, 06:37 AM   #1
Black Hawk
Member
 
Registered: Mar 2006
Distribution: Ubuntu 7.10
Posts: 39
Thanked: 0
How do I run a command at every boot


[Log in to get rid of this advertisement]
Hi. How do I run a command every time linux starts?. I want to run it as root.
Black Hawk is offline  
Tag This Post , , ,
Reply With Quote
Old 01-21-2007, 06:46 AM   #2
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678
Thanked: 126
Depends a bit what you want to do, but you could add a line to crontab such as:

@reboot command_goes_here

using crontab -e as root
billymayday is offline     Reply With Quote
Old 01-21-2007, 06:50 AM   #3
Black Hawk
Member
 
Registered: Mar 2006
Distribution: Ubuntu 7.10
Posts: 39
Thanked: 0

Original Poster
I want to start the g15daemon. I'm able to start in manually in the konsole with the command g15 daemon
Black Hawk is offline     Reply With Quote
Old 01-21-2007, 07:05 AM   #4
pwc101
Senior Member
 
Registered: Oct 2005
Location: Southampton, UK
Distribution: Slackware
Posts: 1,698
Thanked: 93
Or you could add the command into /etc/rc.local
pwc101 is offline     Reply With Quote
Old 01-21-2007, 07:21 AM   #5
Hitboxx
Senior Member
 
Registered: Mar 2006
Location: India
Distribution: Fedora
Posts: 1,565
Blog Entries: 3
Thanked: 5
OR add the command to your*home*folder/.bash_profile if running for certain users.
Hitboxx is offline     Reply With Quote
Old 01-21-2007, 01:07 PM   #6
Tischbein
Member
 
Registered: Oct 2006
Distribution: debian
Posts: 115
Thanked: 0
The cron option is probably the most portable and future proof from what I gather. If "upstart" takes over the init scripts, crontab, at and all the rest of that kludge of commands the crontab interface will still be supported as a front end; so the developers have pledged.

Is there a cron representation for @boot + 5 minutes? I'm just curious. It would help keep boot time down.

Regards, Tintenfisch
Tischbein is offline     Reply With Quote
Old 01-21-2007, 04:13 PM   #7
Black Hawk
Member
 
Registered: Mar 2006
Distribution: Ubuntu 7.10
Posts: 39
Thanked: 0

Original Poster
Problem solved Thanks
Black Hawk is offline     Reply With Quote
Old 01-21-2007, 05:29 PM   #8
Hitboxx
Senior Member
 
Registered: Mar 2006
Location: India
Distribution: Fedora
Posts: 1,565
Blog Entries: 3
Thanked: 5
Now Black Hawk, we are glad you solved it, but how?? Can you leave the solution here so that others can benefit from it.
Hitboxx is offline     Reply With Quote
Old 02-13-2007, 03:04 PM   #9
Black Hawk
Member
 
Registered: Mar 2006
Distribution: Ubuntu 7.10
Posts: 39
Thanked: 0

Original Poster
I just added "g15daemon" to /etc/rc.local
Black Hawk is offline     Reply With Quote
Old 11-16-2008, 10:18 AM   #10
teluguswan
Member
 
Registered: Oct 2005
Posts: 107
Thanked: 0
Quote:
Originally Posted by Tischbein View Post
The cron option is probably the most portable and future proof from what I gather. If "upstart" takes over the init scripts, crontab, at and all the rest of that kludge of commands the crontab interface will still be supported as a front end; so the developers have pledged.

Is there a cron representation for @boot + 5 minutes? I'm just curious. It would help keep boot time down.

Regards, Tintenfisch

Any one tell where to install the command other than rc.local the above messages said ok do this and that exactly provide the path and filename that will be good.

same i want to put cron job i.e the command

crontab myjobs.cron

myjobs.cron file content is

* 20 * * * halt

daily at 8 in the night my system should shutdown if iam not infront of the system or leave the system. So, where to put the command

crontab myjobs.cron

to run daily

------------------------------------------
teluguswan is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot run command at boot tuffboynyc Red Hat 2 06-22-2006 01:34 PM
I would like to run a command on boot. Slith(++1) Linux - General 4 04-13-2006 08:08 AM
run command on boot FNC Linux - General 1 11-13-2005 06:29 AM
Run a command at boot Ace2005 Debian 3 07-24-2005 10:09 AM
Run command on boot id10t Red Hat 1 01-28-2004 03:34 PM


All times are GMT -5. The time now is 01:36 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration