Wish
to add a new service to start when the machine boots user should add
the necessary script to the directory /etc/init.d/.
- Write a Script for that need to know any programming language #cat >{scriptname}.
- Set permission for that scriptname #chmod 777 {scriptname}, So that every usermode it will run.
After
this we can add the script to runlevel by 2 way automatic or
manually.
Automatic
Way
- #update-rc.d {fulllocation/scriptname} defaultor
- #update-rc.d {fulllocation/scriptname} start 46 2 3 4 5 stop 48 0 1 6
it
will automatically updated and start/stop from next booting time.
Here 46 & 48 is priority of process in boot up time (0 is first
priority and 99 is least priority).
Manually
way
- Copy Script to /etc/init.d.#cp {fulllocation/scriptname} /etc/init.d
- Create softlink to choosen Runlevel's.#ln-s /etc/init.d/{scriptname} /etc/rc0.d/K48{scriptname}#ln-s /etc/init.d/{scriptname} /etc/rc1.d/S46{scriptname}#ln-s /etc/init.d/{scriptname} /etc/rc2.d/S46{scriptname}#ln-s /etc/init.d/{scriptname} /etc/rc3.d/S46{scriptname}#ln-s /etc/init.d/{scriptname} /etc/rc4.d/S46{scriptname}#ln-s /etc/init.d/{scriptname} /etc/rc5.d/S46{scriptname}#ln-s /etc/init.d/{scriptname} /etc/rc6.d/K48{scriptname}
No comments:
Post a Comment