mercredi 4 mars 2015

Running a script during booting/startup; initi.d vs @root


I am currently trying to understand the difference between init.d and @root for running a script at startup/booting of the system.


The use of @root (this method was mentioned in this forum by hs.chandra) is some what simpler by simply going into crontab -e and creating a @root /some_directory/to_your/script/your_script.txt and then your_script.txt shall be executed everytime the system is rebooted.


Alternatively by embedding /etc/init.d/your_script.txt into the second line of your script ie:



#!/bin/bash
# /etc/init.d/your_script.txt


You can run chmod +x /etc/init.d/your_script.txt and that should also result for your_script.txt to run every time the system is booted.


Q1: What is the key differences between the two?

Q2: Which is more robust?

Q3: Is there a better one out of the two?

Q4: Is this the correct way of embedding a script to run during booting?


I will be incorporating a bash .txt file to run during startup.



Aucun commentaire:

Enregistrer un commentaire