LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux 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

Reply
 
Search this Thread
Old 03-13-2008, 02:46 PM   #1
Jongi
Senior Member
 
Registered: Aug 2003
Distribution: Debian Sid 32/64-bit, F10 32/64-bit
Posts: 1,070

Rep: Reputation: 45
Am I missing something when it comes to /etc/rc.local?


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 02:48 PM.
 
Old 03-13-2008, 03:43 PM   #2
hasanatizaz
Member
 
Registered: Nov 2007
Location: Pakistan
Distribution: Redhat and Debian
Posts: 302
Blog Entries: 1

Rep: Reputation: 34
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...
 
Old 03-14-2008, 12:01 AM   #3
Jongi
Senior Member
 
Registered: Aug 2003
Distribution: Debian Sid 32/64-bit, F10 32/64-bit
Posts: 1,070

Original Poster
Rep: Reputation: 45
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
 
Old 03-14-2008, 01:09 AM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,978
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
And ls -l /usr/bin/hellanzb.py ?


Cheers,
Tink
 
Old 03-14-2008, 01:12 AM   #5
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,245
Blog Entries: 15

Rep: Reputation: 233Reputation: 233Reputation: 233
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 01:13 AM.
 
Old 03-14-2008, 02:23 AM   #6
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Does what you are trying to do if you run the copmmand in rc.local manually?
 
Old 03-14-2008, 11:47 AM   #7
Jongi
Senior Member
 
Registered: Aug 2003
Distribution: Debian Sid 32/64-bit, F10 32/64-bit
Posts: 1,070

Original Poster
Rep: Reputation: 45
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 11:56 AM.
 
Old 03-14-2008, 11:58 AM   #8
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,150

Rep: Reputation: 330Reputation: 330Reputation: 330Reputation: 330
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 12:00 PM.
 
Old 03-14-2008, 12:09 PM   #9
Jongi
Senior Member
 
Registered: Aug 2003
Distribution: Debian Sid 32/64-bit, F10 32/64-bit
Posts: 1,070

Original Poster
Rep: Reputation: 45
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 12:16 PM.
 
Old 03-14-2008, 01:54 PM   #10
Jongi
Senior Member
 
Registered: Aug 2003
Distribution: Debian Sid 32/64-bit, F10 32/64-bit
Posts: 1,070

Original Poster
Rep: Reputation: 45
I've "cheated" and just added the command to Autostarted Applications in XFCE. It feels like such a second choice solution though.
 
Old 03-14-2008, 01:55 PM   #11
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,642

Rep: Reputation: 523Reputation: 523Reputation: 523Reputation: 523Reputation: 523Reputation: 523
put in someone's crontab. @reboot /usr/bin/hellanzb.py ?
 
Old 03-14-2008, 05:30 PM   #12
hasanatizaz
Member
 
Registered: Nov 2007
Location: Pakistan
Distribution: Redhat and Debian
Posts: 302
Blog Entries: 1

Rep: Reputation: 34
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
 
Old 03-14-2008, 10:26 PM   #13
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,150

Rep: Reputation: 330Reputation: 330Reputation: 330Reputation: 330
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.
 
Old 03-14-2008, 11:59 PM   #14
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,245
Blog Entries: 15

Rep: Reputation: 233Reputation: 233Reputation: 233
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.
 
Old 03-16-2008, 11:07 AM   #15
Jongi
Senior Member
 
Registered: Aug 2003
Distribution: Debian Sid 32/64-bit, F10 32/64-bit
Posts: 1,070

Original Poster
Rep: Reputation: 45
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
 
  


Reply

Tags
boot, daemon, hellanzb, startup


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 On
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 10:43 AM
Roaming Profile Local Settings Folder missing Pinkks Linux - Networking 6 02-13-2007 02:33 PM
Setup local machine to allow lan machines to retrieve its local user mail. Brian1 Linux - Networking 3 03-30-2006 05:04 AM
Local webserver -- How to deny all client install their local web server--Please help b:z Linux - Networking 13 04-16-2005 07:11 PM
MySQL command prompt (/usr/local/mysql missing) sankar555 Linux - Software 3 03-22-2003 12:48 PM


All times are GMT -5. The time now is 09:14 AM.

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
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration