boot/init Startup not working on suse 10
-
- Posts: 247
- Joined: Sun Jan 16, 2005 11:26 am
boot/init Startup not working on suse 10
Has anyone managed ZM to start automatically at boot in Suse 10? I've seen a few articles on here with various problems/solutions but I still cant get mine to start.
I've tried two ways:
Copy scripts/zm to /etc/init.d, removed functions line, and linked to rc3.d and rc5.d
Nothing much happens at boot. But if I run manually from root it starts fine.
I then wrote my own script that just runs zmpkg.pl (I think that is the script - not in front of my PC now) - that shows errors at boot complaining about not being able to open sock file. As I'm root at startup I dont see how - or is it something to do with mysql not being fully up? Or do I need extra env variables that aren't set at boot?
If anyone has this working I'd appreciate some help.
Thanks
I've tried two ways:
Copy scripts/zm to /etc/init.d, removed functions line, and linked to rc3.d and rc5.d
Nothing much happens at boot. But if I run manually from root it starts fine.
I then wrote my own script that just runs zmpkg.pl (I think that is the script - not in front of my PC now) - that shows errors at boot complaining about not being able to open sock file. As I'm root at startup I dont see how - or is it something to do with mysql not being fully up? Or do I need extra env variables that aren't set at boot?
If anyone has this working I'd appreciate some help.
Thanks
Hi,
insert into /etc/init.d/.depend.start
zm now only will start if mysql is running.
insert into /etc/init.d/.depend.stop
to prevent error messages zm has to be stopped before mysql.
or change /etc/sysconfig/boot
Regards,
Rainer
insert into /etc/init.d/.depend.start
Code: Select all
name_of_zm_startscript: mysql
insert into /etc/init.d/.depend.stop
Code: Select all
mysql: apache2 name_of_zm_startscript
or change /etc/sysconfig/boot
Code: Select all
## Type: yesno
## Default: yes
#
# Run all scripts or rather start/stop all services
# which are independent from each other in parallel.
#
RUN_PARALLEL=no
Rainer
-
- Posts: 247
- Joined: Sun Jan 16, 2005 11:26 am
-
- Posts: 247
- Joined: Sun Jan 16, 2005 11:26 am
Have done all you both suggested but still the same problem. Below is an extract from the shutting down log. When booting I get the same message - what file do I see this boot log in?
Any ideas?
<notice>zm stop
Stopping ZoneMinder: DBI connect('database=zm;host=localhost','zm',...) failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at /usr/lib/perl5/site_perl/5.8.7/ZoneMinder/Config.pm line 89
Can't call method "prepare_cached" on an undefined value at /usr/lib/perl5/site_perl/5.8.7/ZoneMinder/Config.pm line 91.
BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.7/ZoneMinder/Config.pm line 100.
Compilation failed in require at /usr/lib/perl5/site_perl/5.8.7/ZoneMinder.pm line 33.
BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.7/ZoneMinder.pm line 33.
Compilation failed in require at /usr/local/bin/zmpkg.pl line 45.
BEGIN failed--compilation aborted at /usr/local/bin/zmpkg.pl line 45.
/etc/init.d/rc5.d/K10zm: line 153: echo_failure: command not found
Any ideas?
<notice>zm stop
Stopping ZoneMinder: DBI connect('database=zm;host=localhost','zm',...) failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at /usr/lib/perl5/site_perl/5.8.7/ZoneMinder/Config.pm line 89
Can't call method "prepare_cached" on an undefined value at /usr/lib/perl5/site_perl/5.8.7/ZoneMinder/Config.pm line 91.
BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.7/ZoneMinder/Config.pm line 100.
Compilation failed in require at /usr/lib/perl5/site_perl/5.8.7/ZoneMinder.pm line 33.
BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.7/ZoneMinder.pm line 33.
Compilation failed in require at /usr/local/bin/zmpkg.pl line 45.
BEGIN failed--compilation aborted at /usr/local/bin/zmpkg.pl line 45.
/etc/init.d/rc5.d/K10zm: line 153: echo_failure: command not found
-
- Posts: 247
- Joined: Sun Jan 16, 2005 11:26 am
Hi,
you have to take care of mysql is running before zm starts and before zm stops.
In runlevel 3 here mysql is starting before zm and stopping after zm . Same in runlevel 5.
My /etc/init.d/zm looks like
Regards,
Rainer
you have to take care of mysql is running before zm starts and before zm stops.
Code: Select all
/etc/init.d # ls -la rc3.d/ | grep zm
lrwxrwxrwx 1 root root 5 Jun 21 07:32 K09zm -> ../zm
lrwxrwxrwx 1 root root 5 Jun 21 07:32 S13zm -> ../zm
suserv1:/etc/init.d # ls -la rc3.d/ | grep mysql
lrwxrwxrwx 1 root root 8 Jun 17 2005 K10mysql -> ../mysql
lrwxrwxrwx 1 root root 15 Jun 19 18:47 S01mysql-repchk -> ../mysql-repchk
lrwxrwxrwx 1 root root 8 Jun 17 2005 S12mysql -> ../mysql
Code: Select all
cat .depend.start | grep zm
zm: mysql
Code: Select all
cat .depend.stop | grep zm
mysql: apache2 zm
Code: Select all
#
# /etc/init.d/zm
#
# and its symbolic link
#
# /usr/sbin/rczm
#
### BEGIN INIT INFO
# Provides: zm
# Required-Start: mysql
# Required-Stop: mysql
# Default-Start: 2 3 5
# Default-Stop:
# Description: Start the Zoneminder daemon
### END INIT INFO
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status
# rc_status -v ditto but be verbose in local rc status
# rc_status -v -r ditto and clear the local rc status
# rc_failed set local and overall rc status to failed
# rc_failed <num> set local and overall rc status to <num>
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
. /etc/rc.status
# First reset status of this service
rc_reset
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.
prog=ZoneMinder
ZM_VERSION="1.22.2"
ZM_PATH_BIN="/opt/zoneminder/bin"
ZM_CONFIG="/etc/zoneminder/zm.conf"
command="$ZM_PATH_BIN/zmpkg.pl"
[ -f $ZM_CONFIG ] && . $ZM_CONFIG
unset MYSQLD
if test -x /usr/sbin/mysqld-max
then
MYSQLD=/usr/sbin/mysqld-max
elif test -x /usr/sbin/mysqld
then
MYSQLD=/usr/sbin/mysqld
fi
test "$MYSQLD" || { echo "Nor /usr/sbin/mysqld nor /usr/sbin/mysqld-max exists"; rc_failed 5; rc_status -v; rc_exit; }
checkdb() {
GetVer="select Value from Config where Name='ZM_DYN_CURR_VERSION'"
VERSION=`echo $GetVer | mysql -B -h $ZM_DB_HOST -u $ZM_DB_USER -p$ZM_DB_PASS $ZM_DB_NAME | grep -v '^Value'`
RETVAL=$?
if [ $RETVAL != 0 ]; then
echo -e "\033[1;31mNo access to ZoneMinder database. Running $ZM_PATH_BIN/zminit.'\33[0m"
$ZM_PATH_BIN/zminit
echo -e "\033[1;31mTry to start zm again !!\33[0m"
return $RETVAL
fi
echo -e "\033[1;32mO.K. Database exists !\33[0m"
return $RETVAL
}
start() {
until test -S $socket && checkproc $MYSQLD
do
sleep 1
echo -e "\033[1;33mWaiting for MySQL !\33[0m "
done
sleep 5
echo -n "Starting $prog: "
$command start
rc_status -v
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/zm
return $RETVAL
}
stop() {
echo -n "Stopping $prog: "
$command stop
rc_status -v
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/zm
}
status() {
result=`$command status`
if [ "$result" = "running" ]; then
echo "ZoneMinder is running"
RETVAL=0
else
echo "ZoneMinder is stopped"
RETVAL=1
fi
}
case "$1" in
'start')
start
;;
'stop')
stop
;;
'restart')
stop
start
;;
'condrestart')
result=`$command status`
if [ "$result" = "running" ]; then
stop
start
fi
;;
'status')
status
;;
'checkdb')
checkdb
;;
*)
echo "Usage: $0 { start | stop | restart | condrestart | status | checkdb }"
RETVAL=1
;;
esac
ps awx | grep "/opt/zoneminder/bin/zma -m" | grep -v grep | awk '{print $1}' | xargs -i renice 19 -p {}
exit $RETVAL
Rainer
- zoneminder
- Site Admin
- Posts: 5215
- Joined: Wed Jul 09, 2003 2:07 pm
- Location: Bristol, UK
- Contact:
-
- Posts: 247
- Joined: Sun Jan 16, 2005 11:26 am
1.22.3
rmo - script for version 1.22.3
just have to change 2 lines
1. version="1.22.3"
2. ZM_PACH_BIN="/usr/local/bin"
just have to change 2 lines
1. version="1.22.3"
2. ZM_PACH_BIN="/usr/local/bin"