05 August

Add a script to Linux startup

To add a new script or a symbolic link to the startup init to run as  root, need to follow mainly two steps:
1. add the script or symbolic link to /etc/init.d/xxx and change permission to executable for root
2. update all/required run level startup scripts to run the added link

1. To add the link to init.d folder: if its a script, you can copy it:
#cp /path/to/required/file /etc/init.d/file

change executable permission for root(755)
#chmod 775 /etc/init.d/file

2.Now update all run level startups:
#update-rc.d file defaults
here defaults is for adding startup to all run levels

to remove the above script use following:
#update-rc.d -f file remove


to learn more about update-rc.d search manual pages by
apropos update-rc.d

No comments:

Post a Comment

Beyond Toughness: Why Your Car's Brain Needs AEC-Q100 AND ASIL-B

AEC-Q100 vs. ASIL-B: Quality Meets Safety In the era of autonomous driving and electric vehicles, the electron...