Re: SYSTEM V /bin/sh initialization scripts between Lenny an…

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
+ (text/plain)
Delete this message
Reply to this message
Author: Lisa Kachold
Date:  
To: Main PLUG discussion list
Subject: Re: SYSTEM V /bin/sh initialization scripts between Lenny and Ubuntu Server 9.04
Duh!

This is an apparmour issue!

http://ubuntuforums.org/showthread.php?t=788071

I figured it out!

But thanks to all who responded.

On Wed, Mar 24, 2010 at 3:57 PM, Lisa Kachold <>wrote:

> What happened?
>
> I was able to get an application to start with the same /bin/sh script that
> ran on Lenny, but will not run in Ubuntu LTS Serrver?
>
> It's telling me the user path and file path are not there.
>
> root@storm:/home/sts/current/examples# cat /etc/init.d/stsd
> #! /bin/sh
>
> # AUTOMATICLLY GENERATED INIT SCRIPT FROM LAST SETUP.sh run.
> # PLEASE CHECK THAT PATHS ARE CORRECT BEFORE USAGE!
> PREFIX=/home/sts/current
>
> # CONFPREFIX should preferable be common for all versions
> CONFPREFIX=$PREFIX
> #CONFPREFIX=/home/sts/current
>
> # Do we want a watchdog process or not. 1 is yes, 0 is no.
> WATCHDOG=1
>
> # Don't run axissts as root. Specify its user here. Note that this
> # user must have write access to $PREFIX.
> USER=sts
>
> # The maximum number of open files we can handle before the
> # system stops it. Change this if you have defined a higher value in
> # your kernel.
> FILES=10000
>
> STARTPROGRAM=$PREFIX/bin/run_axissts.sh
> DAEMON=$PREFIX/bin/axissts
> SERVICENAME=sts_ststorm8080
> CONFIGFILE=$CONFPREFIX/etc/${SERVICENAME}.conf
> KEYDIR=/home/sts/etc/keys
> PATH=/.:/bin:/usr/bin:/sbin:/usr/sbin
> PIDFILE=$CONFPREFIX/${SERVICENAME}.pid
> WDPIDFILE=$CONFPREFIX/${SERVICENAME}watchdog.pid
>
> ARGS="-f $CONFIGFILE -d -p $PIDFILE -K $KEYDIR"
>
> # Check for existence of $PREFIX.
> if [ -z $PREFIX ]
> then
> echo "You must configure where you have installed $SERVICENAME!"
> exit 0
> fi
>
> # Check if we have write access to the $CONFPREFIX directory
> su $USER -c "test -w $CONFPREFIX"
> filestatus=$?
>
> if [ $filestatus != "0" ]
> then
>     echo "The user $USER needs write access to $CONFPREFIX."
>     exit 0
> fi

>
> # Check if we have a configuration file.
> if [ ! -f $CONFIGFILE ]
> then
> echo "No configuration file: $CONFIGFILE"
> exit 0
> fi
>
> # Check if we have a key directory.
> if [ ! -d $KEYDIR ]
> then
> echo "No key directory!"
> echo "Place the key file you have been given from Axis in $KEYDIR"
> exit 0
> fi
>
> if [ ! -x $DAEMON ]
> then
> echo "No such file: $DAEMON"
> exit 0
> fi
>
> case "$1" in
>   start)
>     echo "Starting Server: $SERVICENAME:"

>
>     # Bump up the number of filedescriptors we can use.
>     ulimit -n $FILES

>
>     if [ $WATCHDOG = 1 ]
>     then
>       COMMAND="$STARTPROGRAM $DAEMON $CONFIGFILE $PIDFILE $WDPIDFILE
> $KEYDIR &"
>     else
>       COMMAND="$DAEMON $ARGS"
>     fi

>
>     # Run the daemon as $USER.

>
>     echo "Starting $COMMAND"
>     su $USER -c "$COMMAND"
>     ;;

>
> stop)
>
>     echo "Stopping Server: $SERVICENAME"

>
>     # Check for watchdog pid file.
>     if [ -f $WDPIDFILE ]
>     then
>       kill `cat $WDPIDFILE`
>       rm -f $WDPIDFILE
>     else
>       if [ $WATCHDOG = 1 ]
>       then
>         echo "No Server Watchdog pid file: $WDPIDFILE!"
>         exit 0
>       fi
>     fi

>
>     # Check for PIDFILE.
>     if [ ! -f $PIDFILE ]
>     then
>       echo "No ST Server pid file: $PIDFILE!"
>       exit 0
>     fi

>
>     kill `cat $PIDFILE`
>     rm -f $PIDFILE
>     ;;

>
>   reload)
>     echo "Not implemented."
>     ;;

>
>   force-reload|restart)
>     sh $0 stop
>     sh $0 start
>     ;;

>
>   status)
>     if [ -f $PIDFILE ]
>     then
>       PID=`cat $PIDFILE`
>       echo "ST Server running as process $PID"
>       exit 0
>     fi
>     ;;
>   *)
>     echo "Usage: /etc/init.d/$SERVICENAME
> {start|stop|restart|force-reload|status}"
>     exit 1
>     ;;

>
> esac
>
> exit 0
> root@storm:/home/sts/current/examples#
>
> When I run the /etc/init.d/stsd file I get:
>
> in/connection_monitor.php
> root      7042  6860  0 15:47 pts/1    00:00:00 grep sts
> root@storm:/home/sts/current/examples# ls -al
> total 72
> drwxr-xr-x  2 sts sts  4096 2010-03-24 15:44 .
> drwxrwxrwx 14 sts sts  4096 2010-03-24 15:44 ..
> -rwxr-xr-x  1 sts sts  2093 2008-08-08 04:05 axissts.conf
> -rwxr-xr-x  1 sts sts  1520 2009-09-28 01:39 gst-install-deps.sh
> -rwxr-xr-x  1 sts sts   795 2007-10-26 05:31 handle_failed_queries.sh
> -rwxr-xr-x  1 sts sts   216 2008-08-20 03:57 logrotate-sts
> -rwxr-xr-x  1 sts sts  3558 2008-08-08 03:56 mediaproxyd
> -rwxr-xr-x  1 sts sts   110 2008-07-28 07:27 php.ini
> -rwxr-xr-x  1 sts sts  3303 2009-08-14 07:31 sthelpers
> -rwxr-xr-x  1 sts sts 18676 2010-02-23 01:02 stmediaconvert
> -rwxr-xr-x  1 sts sts  2900 2010-03-24 15:44 stsd
> -rwxr-xr-x  1 sts sts  2979 2010-03-24 14:07 stsd_dynamic
> -rwxr-xr-x  1 sts sts  4917 2009-09-18 05:43 virtualhost.conf
> root@storm:/home/sts/current/examples# cat /etc/init.d/stsd
> #! /bin/sh

>
> # AUTOMATICLLY GENERATED INIT SCRIPT FROM LAST SETUP.sh run.
> # PLEASE CHECK THAT PATHS ARE CORRECT BEFORE USAGE!
> PREFIX=/home/sts/current
>
> # CONFPREFIX should preferable be common for all versions
> #CONFPREFIX=$PREFIX
> CONFPREFIX=/home/sts/current
>
> # Do we want a watchdog process or not. 1 is yes, 0 is no.
> WATCHDOG=1
>
> # Don't run axissts as root. Specify its user here. Note that this
> # user must have write access to $PREFIX.
> USER=sts
>
> # The maximum number of open files the ST Server can handle before the
> # system stops it. Change this if you have defined a higher value in
> # your kernel.
> FILES=10000
>
> STARTPROGRAM=$PREFIX/bin/run_axissts.sh
> DAEMON=$PREFIX/bin/axissts
> SERVICENAME=sts_ststorm8080
> CONFIGFILE=$CONFPREFIX/etc/${SERVICENAME}.conf
> KEYDIR=/home/sts/etc/keys
> PATH=/.:/bin:/usr/bin:/sbin:/usr/sbin
> PIDFILE=$CONFPREFIX/${SERVICENAME}.pid
> WDPIDFILE=$CONFPREFIX/${SERVICENAME}watchdog.pid
>
> ARGS="-f $CONFIGFILE -d -p $PIDFILE -K $KEYDIR"
>
> # Check for existence of $PREFIX.
> if [ -z $PREFIX ]
> then
> echo "You must configure where you have installed $SERVICENAME!"
> exit 0
> fi
>
> # Check if we have write access to the $CONFPREFIX directory
> su $USER -c "test -w $CONFPREFIX"
> filestatus=$?
>
> if [ $filestatus != "0" ]
> then
>     echo "The user $USER needs write access to $CONFPREFIX."
>     exit 0
> fi

>
> # Check if we have a configuration file.
> if [ ! -f $CONFIGFILE ]
> then
> echo "No configuration file: $CONFIGFILE"
> exit 0
> fi
>
> # Check if we have a key directory.
> if [ ! -d $KEYDIR ]
> then
> echo "No key directory!"
> echo "Place the key file you have been given from Axis in $KEYDIR"
> exit 0
> fi
>
> if [ ! -x $DAEMON ]
> then
> echo "No such file: $DAEMON"
> exit 0
> fi
>
> case "$1" in
>   start)
>     echo "Starting Axis ST Server: $SERVICENAME:"

>
>     # Bump up the number of filedescriptors we can use.
>     ulimit -n $FILES

>
>     if [ $WATCHDOG = 1 ]
>     then
>       COMMAND="$STARTPROGRAM $DAEMON $CONFIGFILE $PIDFILE $WDPIDFILE
> $KEYDIR &"
>     else
>       COMMAND="$DAEMON $ARGS"
>     fi

>
>     # Run the daemon as $USER.

>
>     echo "Starting $COMMAND"
>     su $USER -c "$COMMAND"
>     ;;

>
> stop)
>
>     echo "Stopping Axis ST Server: $SERVICENAME"

>
>     # Check for watchdog pid file.
>     if [ -f $WDPIDFILE ]
>     then
>       kill `cat $WDPIDFILE`
>       rm -f $WDPIDFILE
>     else
>       if [ $WATCHDOG = 1 ]
>       then
>         echo "No ST Server Watchdog pid file: $WDPIDFILE!"
>         exit 0
>       fi
>     fi

>
>     # Check for PIDFILE.
>     if [ ! -f $PIDFILE ]
>     then
>       echo "No ST Server pid file: $PIDFILE!"
>       exit 0
>     fi

>
>     kill `cat $PIDFILE`
>     rm -f $PIDFILE
>     ;;

>
>   reload)
>     echo "Not implemented."
>     ;;

>
>   force-reload|restart)
>     sh $0 stop
>     sh $0 start
>     ;;

>
>   status)
>     if [ -f $PIDFILE ]
>     then
>       PID=`cat $PIDFILE`
>       echo "ST Server running as process $PID"
>       exit 0
>     fi
>     ;;
>   *)
>     echo "Usage: /etc/init.d/$SERVICENAME
> {start|stop|restart|force-reload|status}"
>     exit 1
>     ;;

>
> esac
>
> exit 0
> root@storm:/home/sts/current/examples# clear
> root@storm:/home/sts/current/examples# whoami
> root
> root@storm:/home/sts/current/examples# su - sts
> sts@storm:~$ /etc/init.d/stsd start
> Password:
> su: Authentication failure
>
> sts@storm:~$ exit
> logout
> root@storm:/home/sts/current/examples# cd /etc/init.d
> root@storm:/etc/init.d# ls -al /home/sts/current/etc
> total 28
> drwxr-xr-x  2 sts sts 4096 2010-03-24 15:12 .
> drwxrwxrwx 14 sts sts 4096 2010-03-24 15:44 ..
> -rwxrwxrwx  1 sts sts 1703 2006-05-16 05:41 axissts.conf
> -rwxrwxrwx  1 sts sts  447 2010-03-24 15:12 mediaproxyd.conf
> -rwxrwxrwx  1 sts sts  447 2010-03-24 14:46 mediaproxy_mediastorm554.conf
> -rwxrwxrwx  1 sts sts    4 2010-03-24 14:49
> record_manager.php_storm.ivedasolutions.com.pid
> -rwxrwxrwx  1 sts sts 1559 2010-03-24 14:07 sts_ststorm8080.conf
> root@storm:/etc/init.d# ls -al /home/sts/current/bin
> total 568
> drwxr-xr-x  2 sts sts   4096 2010-03-24 14:59 .
> drwxrwxrwx 14 sts sts   4096 2010-03-24 15:44 ..
> -rwxr-xr-x  1 sts sts 125372 2010-02-23 01:02 axissts
> -rwxr-xr-x  1 sts sts   8909 2009-02-02 07:26 batch_upgrade.php
> -rwxr-xr-x  1 sts sts  29416 2009-08-17 04:21 camera_maintenance.php
> -rwxr-xr-x  1 sts sts   4746 2009-09-02 02:28 camera_upgrade.php
> lrwxrwxrwx  1 sts sts     25 2010-03-24 12:44 config_main.php ->
> ../config/config_main.php
> -rwxr-xr-x  1 sts sts   7078 2009-09-02 02:28 connection_monitor.php
> -rwxr-xr-x  1 sts sts   3025 2009-08-25 03:13 event_cleanup.php
> -rwxr-xr-x  1 sts sts  54670 2009-08-28 09:53 event_rpcgen.py
> -rwxr-xr-x  1 sts sts    784 2006-08-03 03:06 exec_delayed.php
> -rwxr-xr-x  1 sts sts    745 2009-01-05 06:23
> generate_self_signed_certificate.sh
> -rwxr-xr-x  1 sts sts 122260 2010-02-23 01:02 mediaproxy
> -rwxr-xr-x  1 sts sts  13508 2010-02-23 01:02 mjpg2movie
> -rwxr-xr-x  1 sts sts   4279 2009-03-06 05:50 password_manage.php
> -rwxr-xr-x  1 sts sts  12541 2007-10-26 00:04 prune_event_dirs.php
> -rwxr-xr-x  1 sts sts   3439 2009-08-25 03:13 quota_cleanup.php
> -rwxr-xr-x  1 sts sts   6531 2009-10-05 06:07 record_manager.php
> -rwxr-xr-x  1 sts sts   7732 2009-08-25 03:13 rmevents.php
> -rwxr-xr-x  1 sts sts   1834 2008-10-23 05:54 run_axissts.sh
> -rwxr-xr-x  1 sts sts   2422 2008-10-20 01:08 run_mediaproxy.sh
> -rwxr-xr-x  1 sts sts  18311 2009-10-06 10:34 server_watchdog.php
> -rwxr-xr-x  1 sts sts   1342 2009-03-11 06:24 session_cleanup.php
> -rwxr-xr-x  1 sts sts   4302 2009-10-01 07:52 smsclient_http_get.php
> -rwxr-xr-x  1 sts sts   4821 2009-10-01 07:52 smsclient_pixie.php
> -rwxr-xr-x  1 sts sts  57324 2010-02-23 01:02 smtpclient
> -rwxr-xr-x  1 sts sts  18676 2010-02-23 01:02 stmediaconvert
> -rwxr-xr-x  1 sts sts    375 2009-07-15 05:51 stmediaconvert.sh
> root@storm:/etc/init.d# ./stsd start
> Starting Axis ST Server: sts_ststorm8080:
> Starting /home/sts/current/bin/run_axissts.sh /home/sts/current/bin/axissts
> /home/sts/current/etc/sts_ststorm8080.conf
> /home/sts/current/sts_ststorm8080.pid
> /home/sts/current/sts_ststorm8080watchdog.pid /home/sts/etc/keys &
> /home/sts/current/bin/run_axissts.sh: 101: /home/sts/current/bin/axissts:
> not found
> root@storm:/etc/init.d#

>
>
> WTF? (so confiused)!
>
> I even added a ./ to the stsd $PATH and that doesn't work?
>
> No selinux - what could it be?
> --
> Office: (480)307-8707
> AT&T: (503)754-4452
> Systems Engineer
> SomeplaceReallyGood.com
>
>

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss