LinuxQuestions.org
Support LQ: Use code LQCO20 and save 20% on CrossOver Office
Go Back   LinuxQuestions.org > Forums > Linux > Linux - General
User Name
Password
Linux - General This forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Tags used in this thread
Popular LQ Tags , , ,

Reply
 
Thread Tools
Old 03-13-2008, 03:46 PM   #1
Jongi
Senior Member
 
Registered: Aug 2003
Distribution: Debian Sid 32/64-bit, F10 32/64-bit
Posts: 1,070
Thanked: 0
Am I missing something when it comes to /etc/rc.local?


[Log in to get rid of this advertisement]
My understanding is that if I put a command in /etc/rc.local, it should run at boot. However take a look at my /etc/rc.local and look at the output of ps aux straight afrer boot and you will see that hellanzb.py is not running

Code:
[root:~#] cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

/usr/bin/hellanzb.py -D
touch /var/lock/subsys/local
Code:
[root:~#] ls /usr/bin/hellanzb.py
/usr/bin/hellanzb.py
I've even tried moving hella to below the line beginning with touch and it still doesn't load.

Code:
[root:~#] ps aux | grep hella
root      2757  0.0  0.0  82236   752 pts/0    S+   23:16   0:00 grep hella
During the boot sequence, if I press Alt-D, I can see right at the end that there is a message that pops up. Where can I look under /var/log to find out what that message is?

Code:
[root:~#] cat /var/log/boot.log
[root:~#] cat /var/log/messages | grep hella
This is on F8 x86_64

Last edited by Jongi; 03-13-2008 at 03:48 PM..
Jongi is offline     Reply With Quote
Old 03-13-2008, 04:43 PM   #2
hasanatizaz
Member
 
Registered: Nov 2007
Location: Pakistan
Distribution: Redhat
Posts: 273
Thanked: 6
if you want to load scripts during BOOT you can put scripts in /etc/rc.d/rc.[the init level you want] make sure its executable...
hasanatizaz is offline     Reply With Quote
Old 03-14-2008, 01:01 AM   #3
Jongi
Senior Member
 
Registered: Aug 2003
Distribution: Debian Sid 32/64-bit, F10 32/64-bit
Posts: 1,070
Thanked: 0

Original Poster
Didn't work as well

Code:
[root:~#] cat /etc/rc.d/rc.5
/home/user/helladaemon
Code:
[root:~#] cat /home/user/helladaemon
#!/bin/bash
/usr/bin/hellanzb.py -D
[root:~#] ls -la /home/user/helladaemon
-rwxrwxr-x 1 jongi jongi 36 2008-03-14 06:47 /home/user/helladaemon
Jongi is offline     Reply With Quote
Old 03-14-2008, 02:09 AM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :}
Posts: 18,849
Blog Entries: 1
Thanked: 160
And ls -l /usr/bin/hellanzb.py ?


Cheers,
Tink
Tinkster is online now     Reply With Quote
Old 03-14-2008, 02:12 AM   #5
konsolebox
Member
 
Registered: Oct 2005
Location: Philippines
Distribution: Gentoo, Slackware
Posts: 957
Thanked: 15
first make sure that /etc/rc.local is really able to run the file. add this inside the file
Code:
exec >/home/user/log
echo "trying to start /home/user/helladaemon"
[ -x /home/user/helladaemon ] && echo "/home/user/helladaemon seems to be not executable in this environment but lets try"
( exec /home/user/helladaemon ; ) &
exec >/dev/stdout
then check /home/user/log

Last edited by konsolebox; 03-14-2008 at 02:13 AM..
konsolebox is offline     Reply With Quote
Old 03-14-2008, 03:23 AM   #6
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678
Thanked: 126
Does what you are trying to do if you run the copmmand in rc.local manually?
billymayday is offline     Reply With Quote
Old 03-14-2008, 12:47 PM   #7
Jongi
Senior Member
 
Registered: Aug 2003
Distribution: Debian Sid 32/64-bit, F10 32/64-bit
Posts: 1,070
Thanked: 0

Original Poster
Code:
[root:~#] ls -la /usr/bin/hellanzb.py
-rwxr-xr-x 1 root root 1942 2008-02-15 19:05 /usr/bin/hellanzb.py
Code:
[root:~#] ls -la /etc/rc.local
lrwxrwxrwx 1 root root 13 2008-02-15 00:01 /etc/rc.local -> rc.d/rc.local
Code:
[root:~#] cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
exec >/home/user/log
echo "trying to start /home/user/helladaemon"
[ -x /home/user/helladaemon ] && echo "/home/user/helladaemon seems to be not executable in this environment but lets try"
( exec /home/user/helladaemon ; ) &
exec >/dev/stdout
Code:
[root:~#] cat /home/user/log
[root:~#]

Last edited by Jongi; 03-14-2008 at 12:56 PM..
Jongi is offline     Reply With Quote
Old 03-14-2008, 12:58 PM   #8
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 2,847
Thanked: 78
Perhaps you need a disown command after you start the process so it won't terminate when the rc.local script terminates.

Without a disown, script termination automatically sends a "kill" signal to any of its children. Note that, unless you use an argument, the disown command should be the next command that the script runs since, by default, it "disowns" the last prior executed command.

Last edited by PTrenholme; 03-14-2008 at 01:00 PM..
PTrenholme is offline     Reply With Quote
Old 03-14-2008, 01:09 PM   #9
Jongi
Senior Member
 
Registered: Aug 2003
Distribution: Debian Sid 32/64-bit, F10 32/64-bit
Posts: 1,070
Thanked: 0

Original Poster
ah ha. I suspected something like that.

so have it look like this:

Code:
touch /var/lock/subsys/local
/usr/bin/hellanzb.py -D
disown
EDIT: Nope, didn't do the trick

Last edited by Jongi; 03-14-2008 at 01:16 PM..
Jongi is offline     Reply With Quote
Old 03-14-2008, 02:54 PM   #10
Jongi
Senior Member
 
Registered: Aug 2003
Distribution: Debian Sid 32/64-bit, F10 32/64-bit
Posts: 1,070
Thanked: 0

Original Poster
I've "cheated" and just added the command to Autostarted Applications in XFCE. It feels like such a second choice solution though.
Jongi is offline     Reply With Quote
Old 03-14-2008, 02:55 PM   #11
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 1,551
Thanked: 76
put in someone's crontab. @reboot /usr/bin/hellanzb.py ?
AlucardZero is offline     Reply With Quote
Old 03-14-2008, 06:30 PM   #12
hasanatizaz
Member
 
Registered: Nov 2007
Location: Pakistan
Distribution: Redhat
Posts: 273
Thanked: 6
Jongi
are u setting 777 i mean are u giving the executable permission ?
it needs to begin with S --> inorder to start
and then the process number -- > 97 for example | inorder to initiate the process with the priority as a number.


S97filename | make sure its 7xx
hasanatizaz is offline     Reply With Quote
Old 03-14-2008, 11:26 PM   #13
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 2,847
Thanked: 78
Quote:
Originally Posted by geniushasan View Post
Jongi
are u setting 777 i mean are u giving the executable permission ?
it needs to begin with S --> inorder to start
and then the process number -- > 97 for example | inorder to initiate the process with the priority as a number.


S97filename | make sure its 7xx
Wouldn't that advice only apply if the Python program was in /etc/rc.d//init.d and being started as a service? The question was "How to run the script from /etc/rc/rc.local, although starting it as a service is not a bad idea.

If the OP wants to set it up as a service, a look at the scripts in /etc/rc.d/init.d should make the general process clear, and creating a link to the service script from /etc/rd.d/rc.5 in the format suggested above is relatively straight forward.

Note: The use of /etc/rc.d/ rather than /etc is, I believe, distribution specific, so the actual location of your service initiation scripts my differ from the location I specified. But they shouldn't be too hard to find.
PTrenholme is offline     Reply With Quote
Old 03-15-2008, 12:59 AM   #14
konsolebox
Member
 
Registered: Oct 2005
Location: Philippines
Distribution: Gentoo, Slackware
Posts: 957
Thanked: 15
You should simply find the way to start your /etc/rc.d/rc.local. Check your other /etc/rc.d/* files and find clues on how they are started. Perhaps changing the execution permissions or pointing a link to the file in a runtime directory will do the trick.
konsolebox is offline     Reply With Quote
Old 03-16-2008, 12:07 PM   #15
Jongi
Senior Member
 
Registered: Aug 2003
Distribution: Debian Sid 32/64-bit, F10 32/64-bit
Posts: 1,070
Thanked: 0

Original Poster
Quote:
Originally Posted by geniushasan View Post
Jongi
are u setting 777 i mean are u giving the executable permission ?
it needs to begin with S --> inorder to start
and then the process number -- > 97 for example | inorder to initiate the process with the priority as a number.


S97filename | make sure its 7xx
I have no clue what it is you mean
Jongi 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
how can i add a local Folder on local Hard Disk as Yum Repository ?? vahid_p Fedora 4 02-22-2007 11:43 AM
Roaming Profile Local Settings Folder missing Pinkks Linux - Networking 6 02-13-2007 03:33 PM
Setup local machine to allow lan machines to retrieve its local user mail. Brian1 Linux - Networking 3 03-30-2006 06:04 AM
Local webserver -- How to deny all client install their local web server--Please help b:z Linux - Networking 13 04-16-2005 08:11 PM
MySQL command prompt (/usr/local/mysql missing) sankar555 Linux - Software 3 03-22-2003 01:48 PM


All times are GMT -5. The time now is 02:08 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