LinuxQuestions.org
Review your favorite Linux distribution.
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-08-2012, 02:47 PM   #1
number22
Member
 
Registered: Sep 2006
Location: Earth
Distribution: Slackware 14.1 Slackware64-current multilib
Posts: 278
Blog Entries: 7

Rep: Reputation: Disabled
rc.M script syntax changes between 12.0 and 13.37, rc.apcupsd scripts has exit 0.


I am having problem with rc.M script. example
Code:
 
# Start the local setup procedure.
if [ -x /etc/rc.d/rc.myscripts ]; then
  /etc/rc.d/rc.myscripts start
fi
without . and space in front /etc/rc.d/rc.myscripts start this line will automatic load during boot process(13.37 64bit system) but if I add .
Code:
 
# Start the local setup procedure.
if [ -x /etc/rc.d/rc.myscripts ]; then
  . /etc/rc.d/rc.myscripts start
fi
this line will not automatic load in 13.37 system, but works 12.0 system, can anyone point out why and where can i get more info on rc.M scripts syntax, I am using 13.37 64bit and 12.2 both systems, thanks.

Last edited by number22; 02-08-2012 at 05:33 PM.
 
Old 02-08-2012, 03:21 PM   #2
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 244Reputation: 244Reputation: 244
Is there any action in rc.myscripts when $1 equals "start" ?
Maybe you could post rc.myscripts ?
 
Old 02-08-2012, 03:44 PM   #3
number22
Member
 
Registered: Sep 2006
Location: Earth
Distribution: Slackware 14.1 Slackware64-current multilib
Posts: 278

Original Poster
Blog Entries: 7

Rep: Reputation: Disabled
Code:
#!/bin/sh
# Start/stop/restart commands

if [ "$1" = "stop" ]; then
  echo "Stopping commands"
  /usr/local/sbin/commands -s
elif [ "$1" = "restart" ]; then
  echo "Restarting commands"
  /usr/local/sbin/commands -s
  sleep 1
  /usr/local/sbin/commands -d /dev/ttyS0 -S 9600
elif [ "$1" = "start" ]; then
  echo "Starting commands"
  /usr/local/sbin/commands -d /dev/ttyS0 -S 9600 
fi
yeah, "$1" = "start" in a if conditional selection, very simple and rudimentary scripts
 
Old 02-08-2012, 04:08 PM   #4
number22
Member
 
Registered: Sep 2006
Location: Earth
Distribution: Slackware 14.1 Slackware64-current multilib
Posts: 278

Original Poster
Blog Entries: 7

Rep: Reputation: Disabled
I think I figured out why, installed slackbuild apcupsd, the rc.apcupsd scripts has exit 0 at end. comment it out, fixed bash . source command for rest of rc.M file.

If scripts have exit 0 at end of bash script, it will properly exit, don't need to add . source command in rc.M script to call up this bash script. otherwise, it will force exit rc.M in the middle.

Last edited by number22; 02-08-2012 at 06:59 PM.
 
  


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
Script Syntax off -- Don't see it. jv2112 Linux - Newbie 6 12-23-2011 05:16 PM
[SOLVED] need help with script syntax,etc linus72 Linux - General 3 09-10-2010 07:53 AM
is there a '?:' syntax shell script? logicalfuzz Linux - General 3 01-29-2010 09:26 AM
Help with sh script syntax needed ! MikeAtVillage Programming 4 03-31-2006 02:39 AM
Shell Script Syntax dragon49 Programming 1 03-12-2003 09:25 AM

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

All times are GMT -5. The time now is 09:30 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
Open Source Consulting | Domain Registration