Hello out there,
I have a problem with an init-script. I want to startup vmware, but to test the possibilties of init-scripts, I wrote a simple perl-script.
#! /usr/bin/perl
use warnings;
use strict;
my $filename = "/var/log/vmsimLOG.txt";
while(1)
{
open (FH, "> $filename") or die "cannot open file\n";
print FH "struntprat\n";
sleep(1);
close(FH);
}
and copied it to /usr/sbin. And changed the permission +x
Now I took the skeleton-init-script from "/etc/init.d" and try to adapt it tp my needs.
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="VMware start script"
NAME=vmsim.pl
DAEMON=/usr/sbin/vmsim.pl
#DAEMON_ARGS=""
#PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
log_daemon_msg () {
if [ -z "${1:-}" ]; then
return 1
fi
if [ -z "${2:-}" ]; then
echo -n "$1:"
return
fi
echo -n "$1: $2"
}
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
echo "jag är här"
start-stop-daemon --start --quiet --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --exec $DAEMON -- \
$DAEMON_ARGS \
|| return 2
# Add code here, if necessary, that waits for the process to be ready
# to handle requests from services started subsequently which depend
# on this one. As a last resort, sleep for some time.
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
echo "jag är i Duff-Device"
do_start
#case "$?" in
# 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
# 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
#esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
#case "$?" in
....
by the way, do we have a nopaste-service here?
I copied it as vmware back to /etc/init.d and installed it with:
update-rc.d vmware defaults 20
So if I invoke this script with /etc/init.d/vmware, I got only the message:
Quote:
Starting VMware start script: vmsim.pl
and afterward nothing happens. If I boot with this script the boot-process freeze. I had to fix it with a live-cd-boot.
Does anybody see where the problem is?
Thank you
Gruss Christian
Bookmark/Search this post with:
init-script freeze
Your init script is fairly complicated. You should try to simplify it to your needs. I don't really understand it as all your Perl script does is write to a file. My guess is that you can't run vmware as a daemon as it needs to be run with X windows. It doesn't make much sense to run it as a daemon even if that were possible as it needs input from the user and needs to be able to display something. I mean that is the whole purpose of the program.