LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   start an user script at boot: Shall we prefer the INITTAB or /etc/init.d method ? (https://www.linuxquestions.org/questions/debian-26/start-an-user-script-at-boot-shall-we-prefer-the-inittab-or-etc-init-d-method-783454/)

frenchn00b 01-20-2010 05:57 AM

start an user script at boot: Shall we prefer the INITTAB or /etc/init.d method ?
 
Hello,

In order to start some scripts from an user, it is better to favour INITTAB or /etc/init.d method?
Quote:

#include <unistd.h>
int main() {
execlp( "login", "login", "-f", "fred", 0);
}

then
gcc -o autologinfred autologinfred.c

then modify:
1:2345:respawn:/sbin/getty -n -l /usr/local/sbin/autologinfred 38400 tty1
then
change the .bashrc


or


/etc/init.d/S98startuserscripts
Code:

#! /bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
if [ `id -u` = 0 ] ; then
  #echo switching to freevo user
  #exec su --shell /bin/sh fred -c "$0 $@"
  su --shell /bin/bash fred -c "sh $HOME/mysupermegascript"
fi
exit 0

What is more secured, what is more standard, what is better, what is more debian i.e. stable?

jens 01-21-2010 06:01 AM

inittab is used for all needed stuff (defaults) to boot your system (init reads this when booting).

/etc/init.d is the normal place for customizing the above and supports more user interaction


All times are GMT -5. The time now is 06:04 PM.