|
Script no in init.d
Hello
I've created a quick init.d script for a virtualbox VM.
For simple startup, and shutdown.
It works when I run it from the directory I created it in. When I copy it to the init.d and chmod 755 it. It does not run, no errors. Infact I get:
Stopping virtualbox-windows7 (via systemctl): [ OK ].
This IS the default init.d output. NONE of the script is being run. I slipped in dummy echoes to be certain.
I can add it with chkconfig --add.
I've attempted running the links after the add command with the exact same results.
Have attempted removing via chkconfig, deleting and recreating.
Have attempted creating the file directly in the init.d directory.
Have attempted cp the file to the init.d directory.
Have attempted running it from /etc/rc.d/init.d, and /etc/init.d.
Have manually checked the /var/lock/subsys/virtualbox, it is not there.
I'm not actually certain what I am doing wrong. This is NOT my first init.d script.
though I doubt this matters, the script is:
#!/bin/sh
#
# chkconfig: 345 98 11
# description: controls the auto start of a virtual machine via virtualbox
# Source function library.
. /etc/init.d/functions
start() {
echo -n "Starting : Virtual Box"
VBoxManage startvm --type headless Windows7
touch /var/lock/subsys/virtualbox
return
}
stop() {
echo -n "Shutting down : Virtual Box"
VBoxManage controlvm Windows7 savestate
rm -f /var/lock/subsys/virtualbox
return
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
VBoxManage showvminfo Windows7
;;
restart)
echo -n "The stop start commands must be used to restart this service."
;;
reload)
;;
condrestart)
;;
*)
echo "Usage: <servicename> {start|stop|status|reload|restart[|probe]"
exit 1
;;
esac
exit $?
Last edited by davidedwardgill; 08-21-2011 at 09:14 AM.
Reason: Adding status line.
|