LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-29-2008, 02:42 PM   #1
stabu
Member
 
Registered: Mar 2004
Location: dublin IRL
Distribution: Slackv12.1, Slamd64v12.1,Xubuntu v8.10_64, FC8_64
Posts: 438
Blog Entries: 5

Rep: Reputation: 32
rc.local for what?


I wanted some service coming up on login, so I put them into rc.local and chmod'd it. Well, they don't load.
Maybe I need to tell rc.M or a more hierarchical script to source it? Of maybe rc.local should be being read, and I've goodfed up my system a little?
 
Old 02-29-2008, 02:47 PM   #2
Poetics
Senior Member
 
Registered: Jun 2003
Location: California
Distribution: Slackware
Posts: 1,181

Rep: Reputation: 49
Does dmesg have any information? What happens if you put a simple print/echo statement in?
 
Old 02-29-2008, 02:49 PM   #3
truthfatal
Member
 
Registered: Mar 2005
Location: Winnipeg, MB
Distribution: Raspbian, Debian, Slackware, OS X
Posts: 443
Blog Entries: 9

Rep: Reputation: 32
If rc.local has been chmodded to +x then it should run fine at boot time.
The only thing I can think of (for a fairly clean system...) is that the programs you not in the boot $PATH, or if you are referencing them by their full location (/opt/bin/whatever) there is a problem with the service itself.

What service are you trying to start?
 
Old 02-29-2008, 03:36 PM   #4
stabu
Member
 
Registered: Mar 2004
Location: dublin IRL
Distribution: Slackv12.1, Slamd64v12.1,Xubuntu v8.10_64, FC8_64
Posts: 438

Original Poster
Blog Entries: 5

Rep: Reputation: 32
oh yes, I got it now. hese service are in my $PATH, but not the bootpath. AS rc.local gets sourced real early, my .bashrc hasn't had a chance to export the paths these services lie in. That's the explanation.
I suppose I¡ll just launch them from .bashrc then, like everything else.
Or change my boot path, I'll have to look for it.

Many thanks for you answers, Appreciated.
 
Old 02-29-2008, 04:23 PM   #5
Poetics
Senior Member
 
Registered: Jun 2003
Location: California
Distribution: Slackware
Posts: 1,181

Rep: Reputation: 49
That's not quite it, actually. Your .bashrc is only read and implemented when you yourself log in. If you had multiple users, each with their .bashrc or .bash_profile, none of them would be active except for the specific user, and only after they had logged in. The system itself doesn't care what is in your path, as you've discovered, only what's in its path.

In rc.local I always make sure to use absolute pathnames to make sure I don't run into this problem.
 
Old 03-01-2008, 02:39 AM   #6
rg3
Member
 
Registered: Jul 2007
Distribution: Fedora
Posts: 527

Rep: Reputation: Disabled
Yes, more or less .bashrc is read everytime you launch the bash interpreter, and for your user. Take into account stuff launched from rc.local will run as root unless you launch it with sudo (or a similar tool) or the program explicitly changes to another user (many daemons do that and drop privileges to be more secure).
 
Old 03-01-2008, 02:43 AM   #7
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
Just run them from rc.local with the full path to the program.
 
Old 03-01-2008, 05:07 AM   #8
stabu
Member
 
Registered: Mar 2004
Location: dublin IRL
Distribution: Slackv12.1, Slamd64v12.1,Xubuntu v8.10_64, FC8_64
Posts: 438

Original Poster
Blog Entries: 5

Rep: Reputation: 32
Hi, yes, thanks for the comments.
putting them in .bashrc didn't feel right, you're right Poetics.
So I went into rc.S and changed the bootpath. Guess what, it didn't work.
Wow, does rc.local get sourced early or what?
But from the replies, it seems that the absolute path manner is the one to use.
Many thanks!
 
Old 03-01-2008, 10:09 AM   #9
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
rc.local is the *last* init script to run, just before login is called. It's the proper place to put any extras you need to run during bootup. Normally you shouldn't alter the other scripts unless you really know what you are doing and why. Many extra program packages include a routine which writes an entry to rc.local which gets run during each boot-up. The routines usually look somthing like this:

Code:
if [ -x /etc/rc.d/extra-service ] ; then
 . /etc/rc.d/extra-service
fi
The referenced script might look something like this:
Code:
#!/bin/sh
 /path/to/extra_service
Having a setup like this allows you to enable or disable the extra_service program simply by making the /etc/rc.d/extra-service script executable or non-executable.
The best way to ensure that the service gets started properly is to run it using the full path.
 
Old 03-01-2008, 12:05 PM   #10
tfrei
Member
 
Registered: Dec 2004
Location: Fargo
Distribution: slackware 14.2
Posts: 103

Rep: Reputation: 18
is this the proper format?

I have the following in my rc.local, but it doesn't seem to work. Am I doing something wrong?

#!/bin/sh
#
# /etc/rc.d/rc.local: Local system initialization script.
#
# Put any local startup commands in here. Also, if you have
# anything that needs to be run at shutdown time you can
# make an /etc/rc.d/rc.local_shutdown script and put those
# commands in there.

/usr/local/slimserver/slimserver.pl --daemon
 
Old 03-01-2008, 12:12 PM   #11
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
What runlevel are you using?
Does the program run if you run it manually after logging in in runlevel 3?
Make sure there is a blank line after the line with the command.
You may need to put '&' after the command to background it.
 
Old 03-01-2008, 07:05 PM   #12
tfrei
Member
 
Registered: Dec 2004
Location: Fargo
Distribution: slackware 14.2
Posts: 103

Rep: Reputation: 18
Quote:
Originally Posted by gnashley View Post
What runlevel are you using?
Does the program run if you run it manually after logging in in runlevel 3?
Make sure there is a blank line after the line with the command.
You may need to put '&' after the command to background it.
I'm using runlevel 3.
I will check for the blank line.
And I will also try using "&" after the command. Thanks. Here again is my rc.local:
Code:
#!/bin/sh
#
# /etc/rc.d/rc.local:  Local system initialization script.
#
# Put any local startup commands in here.  Also, if you have
# anything that needs to be run at shutdown time you can
# make an /etc/rc.d/rc.local_shutdown script and put those
# commands in there.

/usr/local/slimserver/slimserver.pl --daemon
Thanks for your help.
 
Old 03-01-2008, 07:14 PM   #13
tfrei
Member
 
Registered: Dec 2004
Location: Fargo
Distribution: slackware 14.2
Posts: 103

Rep: Reputation: 18
Quote:
Originally Posted by gnashley View Post
What runlevel are you using?
Does the program run if you run it manually after logging in in runlevel 3?
Make sure there is a blank line after the line with the command.
You may need to put '&' after the command to background it.
I made sure there is a blank line after the command.
I've checked and the same command works in runlevel 3 before I manually start x. Still, rc.local does execute the command.

I will try the "&" next. I assume the command should be:

Code:
/usr/local/slimserver/slimserver.pl --daemon &
 
Old 03-01-2008, 07:40 PM   #14
tfrei
Member
 
Registered: Dec 2004
Location: Fargo
Distribution: slackware 14.2
Posts: 103

Rep: Reputation: 18
Quote:
Originally Posted by gnashley View Post
What runlevel are you using?
Does the program run if you run it manually after logging in in runlevel 3?
Make sure there is a blank line after the line with the command.
You may need to put '&' after the command to background it.
Everything is as it should be according to your questions. I did get rc.local to echo a message, so I know the file is working.

I've tried the command with and without the "&" at the end. Here is my rc.local as it now stands:
Code:
#!/bin/sh
#
# /etc/rc.d/rc.local:  Local system initialization script.
#
# Put any local startup commands in here.  Also, if you have
# anything that needs to be run at shutdown time you can
# make an /etc/rc.d/rc.local_shutdown script and put those
# commands in there.
/usr/local/slimserver/slimserver.pl --daemon &
That this doesn't work is no big deal, but I'm curious none the less why it doesn't.
 
Old 03-01-2008, 08:34 PM   #15
rworkman
Slackware Contributor
 
Registered: Oct 2004
Location: Tuscaloosa, Alabama (USA)
Distribution: Slackware
Posts: 2,559

Rep: Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351
Quote:
Originally Posted by tfrei View Post
Everything is as it should be according to your questions. I did get rc.local to echo a message, so I know the file is working.

I've tried the command with and without the "&" at the end. Here is my rc.local as it now stands:
Code:
#!/bin/sh
#
# /etc/rc.d/rc.local:  Local system initialization script.
#
# Put any local startup commands in here.  Also, if you have
# anything that needs to be run at shutdown time you can
# make an /etc/rc.d/rc.local_shutdown script and put those
# commands in there.
/usr/local/slimserver/slimserver.pl --daemon &
That this doesn't work is no big deal, but I'm curious none the less why it doesn't.

I suspect it's because you're not telling it which user to run as.
http://slackbuilds.org/repository/12...ia/SlimServer/
 
  


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
Forward local mail to another local host using sendmail loopy69 Linux - Server 5 02-26-2008 05:38 PM
how can i add a local Folder on local Hard Disk as Yum Repository ?? vahid_p Fedora 4 02-22-2007 10:43 AM
shell script to compare filese b/w local and remote and delete files from local serve dsids Linux - Networking 9 08-23-2006 07:20 AM
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

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

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