Operating System - HP-UX
1849152 Members
4630 Online
104041 Solutions
New Discussion

Re: usage errors on startup scripts

 
SOLVED
Go to solution
Todd McDaniel_1
Honored Contributor

usage errors on startup scripts

all:

I have a situation that i hope you can help with.

I have several boxes all having issues with the same startup scripts not running at boot time. The permissions and ownership look fine to me, but i have a few questions.

In my /etc/rc.log i get usage errors for these scripts.

===========================================
# grep Usage /etc/rc.log
Usage: /sbin/rc3.d/S95xvfb { start | stop }
Usage: /sbin/rc3.d/S97ofx { start | stop }
===========================================


1) does the naming convention matter? the links in /sbin/rc3.d dont match the original file name.

2) does the SXXX part matter if it is only 2 digits? as in my examples below.

3) I was told the linked file permissions dont matter only the orignial file permissions so far as being executable, which they are, but read access isnt there.

=============================================
root:/sbin/rc3.d
lrwxr-xr-x 1 root sys 21 Oct 23 12:51 S95xvfb -> /sbin/init.
d/xvfbinit
lrwxr-xr-x 1 root sys 20 Oct 23 12:51 S97ofx -> /sbin/init.d
/ofxinit
=============================================

-rwxr-xr-x 1 root sys 828 Dec 22 2005 ofxinit
-rwxr-xr-x 1 root sys 507 Dec 22 2005 xvfbinit
Unix, the other white meat.
11 REPLIES 11
Jeff_Traigle
Honored Contributor

Re: usage errors on startup scripts

Looks to me like the logic of the init scripts themselves. Perhaps no "start" and "stop" matches in the case statement so it's returning the usage message as the default action.
--
Jeff Traigle
Jeff_Traigle
Honored Contributor

Re: usage errors on startup scripts

As to the specific questions posed:

1. Makes no difference.

2. Makes no difference. The numbers are just a mechanism to order the execution of the scripts. As long as they start with S, they will be executed at the start of that init state. The link could have no number... it would just be executed in ASCII order along with the ones that contain numbers.

3. Symlink permissions are irrelevant (although it appears all permissions in fact match in your case). Permissions don't appear to be your problem though since you're getting the usage message instead of some kind of permission denied error.
--
Jeff Traigle
Todd McDaniel_1
Honored Contributor

Re: usage errors on startup scripts

okay thanks, thats what i have been saying all along. That it is the scripts themselves not the startup routine.
Unix, the other white meat.
Todd McDaniel_1
Honored Contributor

Re: usage errors on startup scripts

Based on the fact that it falls thru the case statement to the exit and consequentn usage message, tells me the input for the script is invalid in someway...
Unix, the other white meat.
Todd McDaniel_1
Honored Contributor

Re: usage errors on startup scripts


It does "echo: the startup statement in the first case argument, so it appears to try and start the scripts, but then It falls thru the case statement to the final exit case argument at the bottom.

Almost as if it runs 2 parts of the case and not only 1 part.

# vi /etc/rc.log
Usage: /sbin/rc3.d/S95xvfb { start | stop }
Output from "/sbin/rc3.d/S95xvfb start":
----------------------------
***Starting up the Virtual Frame Buffer on Screen 1***

Usage: /sbin/rc3.d/S97ofx { start | stop }
Output from "/sbin/rc3.d/S97ofx start":
----------------------------
***Starting up the Spatial FX Server 3.3 using Virtual Framebuffer (xvfb)***
Unix, the other white meat.
Patrick Wallek
Honored Contributor

Re: usage errors on startup scripts

Can you possibly post the scripts so we can see them?

When the system starts, it takes the /sbin/rc?.d/S* scripts and does, for example,:

S97ofx start

Now, if the case statement is not recognizing 'start' then it will fail. Perhaps start is spelled Start, or START or something. It must be an all lower case 'start' for the script to function correctly.
Todd McDaniel_1
Honored Contributor

Re: usage errors on startup scripts

here you go.

============================================# cat ofxinit
#!/usr/bin/ksh
#

case "$1" in
'start')
if [ -x /app1/ofx/SpatialFX33Server/server/startServer.sh ] ; then
echo "***Starting up the Spatial FX Server 3.3 using Virtual Fra
mebuffer (xvfb)***"
DISPLAY=:1.0
export DISPLAY
#sleep 15
cd /app1/ofx/SpatialFX33Server/server
/app1/ofx/SpatialFX33Server/server/startServer.sh > /app1/ofx/lo
gs/ofx.log 2>&1 &
fi
;;

'stop')
# /usr/bin/pkill -9 -x -u 0 '(startServer)'
for I in `ps -ef | grep [S]erver/j2 | awk '{print $2}'`
do
ps -ef | grep [S]erver/j2
echo $I
/usr/bin/kill -9 $I >> /app1/ofx/logs/ofx.out
done
for I in `ps -ef | grep [o]fx | awk '{print $2}'`
do
ps -ef | grep [o]fx
echo $I
/usr/bin/kill -9 $I >> /app1/ofx/logs/ofx.out
done
;;
*)
echo "Usage: $0 { start | stop }"
exit 1
;;
esac
exit 0
============================================
# cat xvfbinit
#!/sbin/sh
#
case "$1" in
'start')

# start the X Virtual Framebuffer (Xvfb) *dek* 02/17/00
if [ -f /usr/bin/X11/Xvfb ]; then
echo "***Starting up the Virtual Frame Buffer on Screen 1***"
/usr/bin/X11/Xvfb :1 -screen 0 1152x900x8 > /app1/ofx/logs/Xvfb.
log 2>&1 &
fi
;;

'stop')
# /usr/bin/pkill -9 -x -u 0 '(Xvfb)'
for I in `ps -ef | grep [X]vfb | awk '{print $2}'`
do
kill -9 $I
done
;;
*)
echo "Usage: $0 { start | stop }"
exit 1
;;
esac
exit 0

============================================

Unix, the other white meat.
Todd McDaniel_1
Honored Contributor

Re: usage errors on startup scripts

OMG could it be that easy?

Look at the mixture of single and double quotes...


doubles on the actual case statement then singles on the values...

Unix, the other white meat.
James R. Ferguson
Acclaimed Contributor
Solution

Re: usage errors on startup scripts

Hi Todd:

It appears that you have violated the convention required for the startup scripts.

One of four possible arguments will be received by any startup/shutdown script: "start_msg", "start", "stop_msg" or "stop".

This is clearly seen in '/sbin/init.d/template". The manpages for 'rc(1M)' documents this further. The strings of "*_msg" are used to formulate the console checklist. The arguments without "_msg" trigger the script to actually perform startup or shutdown work.

Regards!

...JRF...
Patrick Wallek
Honored Contributor

Re: usage errors on startup scripts

Try removing the double quotes from around your "$1" so it is just $1 in the scripts and try again.
Bill Hassell
Honored Contributor

Re: usage errors on startup scripts

And to clarify your question about 2 digit versus 3 digit sequencing numbers -- they are critically important! S95 and S095 will execute at very, very different time during bootup. The start/stop scripts are run in alphabetical order and the magnitude of the number portion is NOT used!! Instead, it is an alphabetical sort, the same as an ls listing. Take this list:

S001abc
S01abc
S055abc
S195abc
S1abc
S55abc
S5abc

This is the ls (or start/stop script) order of execution. You see that S01abc is run BEFORE S055 and S1abc is run AFTER S195abc. That's because the number is simply text and the sort is left to right.

So while S95vxfb is probably correct as it will be run with all the S9------ scripts but it will AFTER S959abc because S95vxfb sorts after S959abc (numbers come before letters in ASCII -- see man ascii)


Bill Hassell, sysadmin