LinuxQuestions.org
Review your favorite Linux distribution.
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, 08: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, 08:22 AM   #2
DJ Shaji
Member
 
Registered: Dec 2004
Location: Yo Momma's house
Distribution: Fedora Rawhide, ArchLinux
Posts: 513
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, 08:22 AM   #3
austinium
Member
 
Registered: Nov 2007
Location: India
Distribution: Debian Stable, Debian Testing
Posts: 218

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, 08: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, 08: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, 08: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, 09: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, 07:33 PM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,258

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
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 07:38 PM. Reason: found orig qn
 
Old 06-21-2011, 07:41 PM   #9
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

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



Cheers,
Tink

Last edited by Tinkster; 06-21-2011 at 07:42 PM.
 
Old 06-27-2011, 08:09 AM   #10
DJ Shaji
Member
 
Registered: Dec 2004
Location: Yo Momma's house
Distribution: Fedora Rawhide, ArchLinux
Posts: 513
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, 07:19 PM   #11
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,258

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


All times are GMT -5. The time now is 07:03 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration