LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux 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


Reply
  Search this Thread
Old 06-21-2011, 07:13 AM   #1
henfos
LQ Newbie
 
Registered: Jun 2011
Posts: 9

Rep: Reputation: Disabled
Not able to add program to startup


Made a little c-program i want to start at boot and found out that i can do that through the rc.local script that runs once every time the computer boots. Say that i have a program called test in /home/user/Documents... what do i write rc.local? Know nothing about scripting and i didnt understand what i read when i googled it :/
 
Old 06-21-2011, 07:22 AM   #2
DJ Shaji
Member
 
Registered: Dec 2004
Location: Yo Momma's house
Distribution: Fedora Rawhide, ArchLinux
Posts: 518
Blog Entries: 15

Rep: Reputation: 106Reputation: 106
Just add a line to rc.local containing the full path to the program you want to run. For example, if I want to run /home/djshaji/Documents/personal/new/c-programs/bin/hello_world, I would simply put the entire path to the program in rc.local. No need to do any scripting.
 
Old 06-21-2011, 07:22 AM   #3
austinium
Member
 
Registered: Nov 2007
Location: India
Distribution: Debian Stable, Debian Testing
Posts: 219

Rep: Reputation: 27
On Gnome you could type
Code:
gnome-session-properties
in a terminal and then add the program you made to the list of Startup Applications.

This works on Gnome 2.30.2, don't know about the newer versions.
 
Old 06-21-2011, 07:29 AM   #4
henfos
LQ Newbie
 
Registered: Jun 2011
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by DJ Shaji View Post
Just add a line to rc.local containing the full path to the program you want to run. For example, if I want to run /home/djshaji/Documents/personal/new/c-programs/bin/hello_world, I would simply put the entire path to the program in rc.local. No need to do any scripting.
And thats what i thought, but when i do that and run the script directly or do a reboot my program never starts. I know because if it starts the first thing it does is write "test" to a textfile, and it runs perfectly if i just run the program directly.
 
Old 06-21-2011, 07:41 AM   #5
henfos
LQ Newbie
 
Registered: Jun 2011
Posts: 9

Original Poster
Rep: Reputation: Disabled
btw. when i run the script in terminal i get segmentation fault...
 
Old 06-21-2011, 07:55 AM   #6
henfos
LQ Newbie
 
Registered: Jun 2011
Posts: 9

Original Poster
Rep: Reputation: Disabled
lol, ill just continue to answer myself so you know where im at. So ive found out that there is no problem with the rc.local script, just that i get segmentation fault. What is this? I can run the applikasjon from window, but not through rc.local
 
Old 06-21-2011, 08:55 AM   #7
henfos
LQ Newbie
 
Registered: Jun 2011
Posts: 9

Original Poster
Rep: Reputation: Disabled
Another rc.local problem :/

Okei, i was a bit quick to push the solved button on my other thread so sorry for spamming the forum :P (Really noob)
My program now starts during the boot through the use of rc.local, but its not still running when i login and check system monitor. My program is essentially an while-loop so it isnt quiting by itself.
 
Old 06-21-2011, 06:33 PM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Really you'd have been better to add to the orig qn I think.
Can you point at or describe/summarise the orig qn for me/us?

Edit: OK, just stumbled across it.

Basically

1. fix the segment violation
2. the entry in rc.local should like something like this
Code:
nohup /dir/myprog > /dir/myprog.log 2>&1 &

HTH

http://rute.2038bug.com/index.html.gz

Last edited by chrism01; 06-21-2011 at 06:38 PM. Reason: found orig qn
 
Old 06-21-2011, 06:41 PM   #9
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
I merged your two threads and marked the resulting one as "unsolved".



Cheers,
Tink

Last edited by Tinkster; 06-21-2011 at 06:42 PM.
 
Old 06-27-2011, 07:09 AM   #10
DJ Shaji
Member
 
Registered: Dec 2004
Location: Yo Momma's house
Distribution: Fedora Rawhide, ArchLinux
Posts: 518
Blog Entries: 15

Rep: Reputation: 106Reputation: 106
OP: You've got to give a little more info, man! If you could share the code of your program, or at least to the point where it segfaults, that'd be great. In the meantime:

1. Where is the file to which your application writes "test"? if you fopen() a file that doesn't exist, the function would return a null pointer, and if you mess around with a null pointer, you're bound to get a SEGV

2. Drink Pepsi
3. Use full paths wherever possible in your program.
 
Old 06-27-2011, 06:19 PM   #11
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
SIGSEGV in C is typically caused by overwriting the end of a char 'string' or an array.
A typical gotcha in re (1) is to forget about the '\0' reqd at the end of a string and write a 'normal' char over it, thus removing the EOS (end-of-string) marker that the C string fns rely on.
 
  


Reply



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
How to add a program to linux startup?? firewiz87 Linux - General 6 11-21-2008 03:22 PM
How to add a startup program in Linux?? Cypher12 Linux - General 3 01-19-2007 02:31 PM
Add Program to startup Shadow2982 Linux - Newbie 1 02-27-2005 05:48 PM
how can i add a program to startup with RH 9.0 akohamen Linux - Networking 1 01-16-2005 04:10 AM
How to add program to startup? lamiczka Linux - Newbie 2 02-17-2004 07:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:43 PM.

Main Menu
Advertisement
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
Twitter: @linuxquestions
Open Source Consulting | Domain Registration