Hi,
How do I get this working in unbuntu 11.xx?
I am the first to admit I am know Linux guru and have never played with automated start up scripts before. I am trying to get Dynimps to start with the OS, and run as a service/demon. But when I try the script below i get a (can't write to PID file) error, or the below
[EMAIL="aaron@ubuntu:/etc/init.d$"]aaron@ubuntu:/etc/init.d$[/EMAIL] dynamips start
Cisco Router Simulation Platform (version 0.2.8-RC2-x86)
Copyright (c) 2005-2007 Christophe Fillot.
Build date: Jan 18 2011 19:22:29
Unable to create lock file "c7200_i0_lock".
VM default: unable to create instance!
C7200: unable to create instance!
so the script is
#!/bin/sh
# Start/stop the dynamips program as a daemon.
#
### BEGIN INIT INFO
# Provides: dynamips
# Default-Start: 2 3 4 5 95
# Default-Stop: 0 1 6 05
# Short-Description: Cisco Hardware Emulator daemon
### END INIT INFO
NAME="dynamips"
ALIES="dynamips"
DAEMON=/usr/bin/$NAME
PIDFILE=/var/run/$ALIES.pid
PORT=7200
DESC="Cisco Hardware Emulator"
SCRIPTNAME=/etc/init.d/$ALIES
WORKDIR=/common/dynamips/$ALIES
test -f $DAEMON || exit 0
. /lib/lsb/init-functions
start() {
log_daemon_msg "Starting $DESC: $ALIES"
start-stop-daemon --start --chdir $WORKDIR --background --make-pidfile --pidfile $PIDFILE --name $NAME --startas $DAEMON -- -H $PORT -l /var/log/$ALIES.log
log_end_msg $?
}
stop() {
log_daemon_msg "Stopping $DESC: $ALIES"
start-stop-daemon --stop --quiet --pidfile $PIDFILE --name $NAME
log_end_msg $?
}
reload() {
log_daemon_msg "Reloading $DESC: $ALIES"
start-stop-daemon --stop --retry 5 --quiet --pidfile $PIDFILE --name $NAME
start-stop-daemon --start --chdir $WORKDIR --background --make-pidfile --pidfile $PIDFILE --name $NAME --startas $DAEMON -- -H $PORT -l /var/log/$ALIES.log
log_end_msg $?
}
status() {
status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
reload)
reload
;;
status)
status
;;
*)
log_action_msg "Usage: $SCRIPTNAME {start|stop|restart|status}"
exit 2
esac
exit 0
Can any one point me in the right direction? I would really like to get this working as manualy starting all the servers after a reboot is pain. Also will a service/demon recover if it crashes, can it be made to check it is running and if not atempt to restart?
Cheers
Aaron