Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 05-20-2007, 11:07 AM   #1
Registered: Apr 2006
Location: Athens, Greece
Distribution: slackware, debian, ubuntu
Posts: 647

Rep: Reputation: 38
a start up script in rc.M stops the following scripts from running

hello everyone,
please have a look at this loading script; it is a redhat intended startup script for the agent of my APC UPS unit. since im running slackware though, i had to make it work for this distro

im running the script from rc.M in a standard way
# Start APC UPS Agent.
if [ -x /etc/rc.d/rc.PBEAgent ]; then
. /etc/rc.d/rc.PBEAgent start
and of course its in 755 chmod..

it starts up fine and i get status about the ups to thats ok...
problem is this:

any scripts i start from rc.M that come AFTER the rc.PBEAgent, do not start!! so proftpd and gpm wouldnt start... i moved the PBEAgent to the very bottom of rc.M file and proftpd and gpm work again... weird... so im thinking there might be something weird in the PBEAgent script. could you please have a look at the 'start' section?... here it is:

case "$1" in
runlevel | grep 1 > /dev/null
if [ $? = 0 ]
echo Can not start in runlevel 1.
exit 1
ps `cat /etc/ 2>/dev/null | awk "{ print "'$1'" }"` | grep Dpicard.main.thread > /dev/null
if [ $? = 0 -a -e /etc/ ]
echo Process Already Started. Cannot start twice.
cd /opt/APC/PowerChuteBusinessEdition/Agent
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/APC/PowerChuteBusinessEdition/Agent/lib/linux
/bin/java/jre/1.4.2_11/bin/java -Dpicard.main.thread=blocking -classpath ./lib/AdvSnmp.jar:./lib/application.jar:./lib/jsdk.jar:./lib/comm.jar:./lib/mail.jar:./lib/RXTXComm.jar:./lib/activation.jar:./lib/util.jar:./lib/m11.jar:./lib/ds.jar:./lib/sss.jar:./lib/pcbe_ds.jar:./comp/AliCommunication.jar:./comp/CommandFileRunner.jar:./comp/DataLogger.jar:./comp/DiscoveryListener.jar:./comp/EventLogger.jar:./comp/EventTracker.jar:./comp/Host.jar:./comp/http.jar:./comp/picard.jar:./comp/PowerSource.jar:./comp/QueryServer.jar:./comp/Security.jar:./comp/ShutdownBehavior.jar:./comp/Shutdowner.jar:./comp/SimpleBroadcaster.jar:./comp/SMTPMailer.jar:./comp/UPSManagerAutoUpdate.jar:./comp/shutdownerlets/OSShutdownerlet.jar:./comp/shutdownerlets/ExchangeShutdownerlet.jar:./comp/shutdownerlets/IISShutdownerlet.jar:./comp/shutdownerlets/NotesShutdownerlet.jar:./comp/shutdownerlets/SQLShutdownerlet.jar:./comp/shutdownerlets/SiebelShutdownerlet.jar:./Resources/Japanese.jar com.apcc.m11.application.PicardApplication @critical.cfg 2>/dev/null 1>/dev/null &
echo "APC UPS Agent started"
echo $! >/etc/
touch /var/lock/subsys/PBEAgent 1>/dev/null 2>/dev/null
exit $?
PID=`cat /etc/ 2>/dev/null | awk "{ print "'$1'" }"`
kill $PID 1>/dev/null 2>/dev/null
rm -f /etc/ 1>/dev/null 2>/dev/null
rm -f /var/lock/subsys/PBEAgent 1>/dev/null 2>/dev/null
exit $?
ps `cat /etc/ 2>/dev/null | awk "{ print "'$1'" }"` | grep Dpicard.main.thread > /dev/null
if [ $? = 0 -a -e /etc/ ]
echo Running
echo Stopped
echo "Usage $0 {start|stop|status}"
exit 1
thank you for your help
Old 05-20-2007, 11:36 AM   #2
Senior Member
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
. /etc/rc.d/rc.PBEAgent start
remove the "."
Old 05-20-2007, 11:51 AM   #3
Alien Bob
Slackware Contributor
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 6,728

Rep: Reputation: 4099Reputation: 4099Reputation: 4099Reputation: 4099Reputation: 4099Reputation: 4099Reputation: 4099Reputation: 4099Reputation: 4099Reputation: 4099Reputation: 4099
When you "source" a script (. /etc/rc.d/rc.PBEAgent start) it will run in the parent script's process.
If that script then calls "exit" not only your script (rc.PBEagent) will end but also the parent script (rc.M) will exit.
That is what you are experiencing here.

Try changing the line in rc.M to this:

/etc/rc.d/rc.PBEAgent start
I.e. with the dot (the "source" command) left out. Then it will not abort your rc.M script.

Old 05-20-2007, 03:20 PM   #4
Registered: Apr 2005
Location: UK
Distribution: Slackware 13.0
Posts: 241

Rep: Reputation: 34
Shoot me down if I'm wrong but is rc.M really the right file to be fiddling with? Isn't this what rc.local was made for... user's custom changes for a local machine?

You will have (admittedly minor) problems upgrading to the next Slackware if you play about and you'll have to port all your changes to rc.M across to the new file. If you'd have done it in rc.local, you wouldn't have that bother.

Additionally, if something in rc.local goes wrong, you don't get this problem affecting everything. What would have happened is that your rc.local script would have stopped executing but not the main rc.M script... so your major services would have continued running.

And rc.local is ONLY run from rc.M, so you wouldn't change your ability to login in an emergency.

Personally, I run *all* my rc.custom scripts from my rc.local in this same way. And when I upgrade I don't have problems and when I mess it up, I know it can only be me that messed it up. And, if the worst comes to the worst, I just chmod -x rc.local and I know that my system will boot how it was originally designed to.
Old 05-20-2007, 06:26 PM   #5
Registered: Apr 2006
Location: Athens, Greece
Distribution: slackware, debian, ubuntu
Posts: 647

Original Poster
Rep: Reputation: 38
i see, but why was everything in rc.M chosen to be run as ". /etc/.... " ??and not without the dot?

as for rc.local, well there are somethings (like the no-ip start up script) that must be run prior to others...
so i can't masquerade proftpd correctly if i don't have the correct internet ip address.

of course i could perhaps move proftpd out of rc.M and put it in rc.local.. so im considering i could do exactly that now..

thank you for your help all
Old 05-20-2007, 06:31 PM   #6
Registered: May 2007
Location: Chas, SC
Distribution: slackware, gentoo, fedora, LFS, sidewinder G2, solaris, FreeBSD, RHEL, SUSE, Backtrack
Posts: 430

Rep: Reputation: 67
with the "." it will source the file but as long as it is executable it should work fine. I will just call the file to be included with the rc.M start rather then calling the file to start.
Old 05-21-2007, 06:35 AM   #7
Registered: Nov 2005
Location: Budapest, Hungary
Distribution: Slackware, Gentoo
Posts: 346

Rep: Reputation: Disabled
Another thing, which i was lazy to bring up a topic for:
Did anyone experience the following:

/etc/rc.d/rc.cups start being called from rc.M normally (eg.:without the .),
but even so anything that's below (after) it doesn't load.
I circumvented it by deleting the exit 1. line from the en of rc.cups, but this probably
isn't the best solution.

Any thoughts?
Old 05-21-2007, 07:21 AM   #8
Senior Member
Registered: Sep 2004
Distribution: slackware
Posts: 2,024

Rep: Reputation: 399Reputation: 399Reputation: 399Reputation: 399
Originally Posted by ledow
Personally, I run *all* my rc.custom scripts from my rc.local in this same way.
I tend to (mis)use Slackware's sysvinit compatibility. This makes it much easier to "package" software which requires init scripts.


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
Server aburptly stops running High CPU usage PERL script after about 5 hours bpmee Linux - Server 3 05-18-2007 12:24 PM
running perl scripts very system start abdul_zu Programming 16 09-26-2005 02:55 AM
Script to see if a process ir running, if not start it ncsuapex Programming 4 07-03-2005 02:27 PM
running start up script Kendo1979 Linux - General 2 11-08-2004 01:48 PM
Start Up Scripts not running MaverickApollo Linux - General 3 10-20-2003 10:31 PM > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:51 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration