#! /bin/shThen save it into `/etc/init.d' and give privilege:
# /etc/init.d/foo
#
# Some things that run always
touch /var/lock/foo
# Carry out specific functions when asked to by the system
case "$1" in
start)
echo "Starting script foo ..."
;;
stop)
echo "Stopping script foo ..."
;;
*)
echo "Usage: /etc/init.d/foo {start|stop}"
exit 1
;;
esac
exit 0
$ chmod 755 /etc/init.d/foo
Add it to default runlevel:
$ update-rc.d foo defaults
没有评论:
发表评论